SYMBOL INDEX (5174 symbols across 449 files) FILE: braincog/base/brainarea/BrainArea.py class BrainArea (line 19) | class BrainArea(nn.Module, abc.ABC): method __init__ (line 25) | def __init__(self): method forward (line 31) | def forward(self, x): method reset (line 39) | def reset(self): class ThreePointForward (line 48) | class ThreePointForward(BrainArea): method __init__ (line 53) | def __init__(self, w1, w2, w3): method forward (line 66) | def forward(self, x): class Feedback (line 78) | class Feedback(BrainArea): method __init__ (line 83) | def __init__(self, w1, w2, w3): method forward (line 96) | def forward(self, x): method reset (line 106) | def reset(self): class TwoInOneOut (line 110) | class TwoInOneOut(BrainArea): method __init__ (line 115) | def __init__(self, w1, w2): method forward (line 126) | def forward(self, x1, x2): class SelfConnectionArea (line 136) | class SelfConnectionArea(BrainArea): method __init__ (line 141) | def __init__(self, w1, w2 ): method forward (line 153) | def forward(self, x): method reset (line 163) | def reset(self): FILE: braincog/base/brainarea/IPL.py class IPLNet (line 29) | class IPLNet(nn.Module): method __init__ (line 34) | def __init__(self, connection): method forward (line 52) | def forward(self, input1, input2): # input from vPMC and STS method UpdateWeight (line 67) | def UpdateWeight(self, i, dw): method reset (line 76) | def reset(self): method getweight (line 86) | def getweight(self): FILE: braincog/base/brainarea/Insula.py class InsulaNet (line 27) | class InsulaNet(nn.Module): method __init__ (line 31) | def __init__(self,connection): method forward (line 44) | def forward(self, input1, input2): # input from IPLv and STS method UpdateWeight (line 54) | def UpdateWeight(self,i,dw): method reset (line 63) | def reset(self): method getweight (line 73) | def getweight(self): FILE: braincog/base/brainarea/PFC.py class PFC (line 7) | class PFC: method __init__ (line 11) | def __init__(self): method forward (line 16) | def forward(self, x): method reset (line 24) | def reset(self): class dlPFC (line 33) | class dlPFC(BaseModule, PFC): method __init__ (line 37) | def __init__(self, method _rest_c (line 52) | def _rest_c(self): method _create_fc (line 56) | def _create_fc(self): FILE: braincog/base/brainarea/basalganglia.py class basalganglia (line 21) | class basalganglia(nn.Module): method __init__ (line 26) | def __init__(self, ns, na, we, wi, node_type): method forward (line 104) | def forward(self, input): method UpdateWeight (line 117) | def UpdateWeight(self, i, dw): method reset (line 127) | def reset(self): method getweight (line 137) | def getweight(self): method getmask (line 144) | def getmask(self): FILE: braincog/base/brainarea/dACC.py class dACC (line 17) | class dACC(BaseModule): method __init__ (line 21) | def __init__(self, method _rest_c (line 42) | def _rest_c(self): method _create_fc (line 46) | def _create_fc(self): method update_c (line 55) | def update_c(self, c, STDP, tau_c=0.2): method forward (line 70) | def forward(self, inputs, epoch): FILE: braincog/base/connection/CustomLinear.py class CustomLinear (line 11) | class CustomLinear(nn.Module): method __init__ (line 16) | def __init__(self, weight, mask=None): method forward (line 22) | def forward(self, x: torch.Tensor): method update (line 31) | def update(self, dw): FILE: braincog/base/connection/layer.py class VotingLayer (line 13) | class VotingLayer(nn.Module): method __init__ (line 19) | def __init__(self, voter_num: int): method forward (line 23) | def forward(self, x: torch.Tensor): class WTALayer (line 29) | class WTALayer(nn.Module): method __init__ (line 34) | def __init__(self, k=1): method forward (line 38) | def forward(self, x: torch.Tensor): class NDropout (line 50) | class NDropout(nn.Module): method __init__ (line 55) | def __init__(self, p): method n_reset (line 60) | def n_reset(self): method create_mask (line 67) | def create_mask(self, x): method forward (line 75) | def forward(self, x): class WSConv2d (line 85) | class WSConv2d(nn.Conv2d): method __init__ (line 87) | def __init__(self, in_channels, out_channels, kernel_size, stride=1, method forward (line 97) | def forward(self, x): class ThresholdDependentBatchNorm2d (line 108) | class ThresholdDependentBatchNorm2d(_BatchNorm): method __init__ (line 114) | def __init__(self, num_features, alpha: float, threshold: float = .5, ... method _check_input_dim (line 126) | def _check_input_dim(self, input): method forward (line 130) | def forward(self, input): class TEBN (line 136) | class TEBN(nn.Module): method __init__ (line 137) | def __init__(self, num_features,step, eps=1e-5, momentum=0.1,**kwargs): method forward (line 142) | def forward(self, input): class LayerNorm (line 153) | class LayerNorm(nn.Module): method __init__ (line 160) | def __init__(self, normalized_shape, eps=1e-6, data_format="channels_l... method forward (line 170) | def forward(self, x): class SMaxPool (line 181) | class SMaxPool(nn.Module): method __init__ (line 189) | def __init__(self, child): method forward (line 194) | def forward(self, x): method reset (line 201) | def reset(self): class LIPool (line 205) | class LIPool(nn.Module): method __init__ (line 213) | def __init__(self, child=None): method forward (line 221) | def forward(self, x): method reset (line 227) | def reset(self): class CustomLinear (line 231) | class CustomLinear(nn.Module): method __init__ (line 233) | def __init__(self, in_channels, out_channels, bias=True): method forward (line 253) | def forward(self, inputs): FILE: braincog/base/conversion/convertor.py class HookScale (line 9) | class HookScale(nn.Module): method __init__ (line 16) | def __init__(self, method forward (line 31) | def forward(self, x): class Hookoutput (line 45) | class Hookoutput(nn.Module): method __init__ (line 50) | def __init__(self, module): method forward (line 55) | def forward(self, x): class Scale (line 61) | class Scale(nn.Module): method __init__ (line 66) | def __init__(self, scale: float = 1.0): method forward (line 70) | def forward(self, x): function reset (line 77) | def reset(self): class Convertor (line 90) | class Convertor(nn.Module): method __init__ (line 111) | def __init__(self, method forward (line 135) | def forward(self, model): method register_hook (line 145) | def register_hook(model, p=0.99, channelnorm=False, gamma=0.999): method get_percentile (line 160) | def get_percentile(model, dataloader, device, batch_num=1): method replace_for_spike (line 172) | def replace_for_spike(model, lipool=True, soft_mode=True, gamma=1, spi... class SNode (line 194) | class SNode(nn.Module): method __init__ (line 201) | def __init__(self, soft_mode=False, gamma=5): method forward (line 210) | def forward(self, x): method hard_reset (line 218) | def hard_reset(self): method soft_reset (line 224) | def soft_reset(self): method reset (line 230) | def reset(self): FILE: braincog/base/conversion/merge.py function mergeConvBN (line 5) | def mergeConvBN(m): function merge (line 26) | def merge(conv, bn): FILE: braincog/base/conversion/spicalib.py class SpiCalib (line 5) | class SpiCalib(nn.Module): method __init__ (line 6) | def __init__(self, allowance): method forward (line 12) | def forward(self, x): method reset (line 33) | def reset(self): FILE: braincog/base/encoder/encoder.py class AutoEncoder (line 7) | class AutoEncoder(nn.Module): method __init__ (line 8) | def __init__(self, step, spike_output=True): method forward (line 21) | def forward(self, x): class Encoder (line 45) | class Encoder(nn.Module): method __init__ (line 56) | def __init__(self, step, encode_type='ttfs', *args, **kwargs): method forward (line 68) | def forward(self, inputs, deletion_prob=None, shift_var=None): method direct (line 97) | def direct(self, inputs): method auto (line 107) | def auto(self, inputs): method ttfs (line 115) | def ttfs(self, inputs): method rate (line 131) | def rate(self, inputs): method phase (line 141) | def phase(self, inputs): method delete (line 162) | def delete(self, inputs, prob): method shift (line 175) | def shift(self, inputs, var): FILE: braincog/base/encoder/population_coding.py class PEncoder (line 5) | class PEncoder(nn.Module): method __init__ (line 11) | def __init__(self, step, encode_type): method forward (line 16) | def forward(self, inputs, num_popneurons, *args, **kwargs): method population_time (line 21) | def population_time(self, inputs, m): method population_voltage (line 62) | def population_voltage(self, inputs, m, VTH): FILE: braincog/base/encoder/qs_coding.py class QSEncoder (line 8) | class QSEncoder: method __init__ (line 19) | def __init__(self, method __call__ (line 37) | def __call__(self, image, image_delta, image_ori, image_ori_delta): method shift_trans (line 56) | def shift_trans(self, image, image_delta, image_ori, image_ori_delta): method noise_trans (line 93) | def noise_trans(self, image, image_ori, image_ori_delta): method reverse_pixels (line 131) | def reverse_pixels(self, image, image_delta, noise_rate, flip_bits=None): FILE: braincog/base/learningrule/BCM.py class BCM (line 20) | class BCM(nn.Module): method __init__ (line 25) | def __init__(self, node, connection, cfunc=None, weightdecay=0.99, tau... method forward (line 43) | def forward(self, *x): method cfunc (line 62) | def cfunc(self, s): method reset (line 67) | def reset(self): FILE: braincog/base/learningrule/Hebb.py class Hebb (line 20) | class Hebb(nn.Module): method __init__ (line 25) | def __init__(self, node, connection): method forward (line 36) | def forward(self, *x): method reset (line 54) | def reset(self): FILE: braincog/base/learningrule/RSTDP.py class RSTDP (line 20) | class RSTDP(nn.Module): method __init__ (line 24) | def __init__(self, node, connection, decay=0.99, reward_decay=0.5): method forward (line 40) | def forward(self, *x, r): method cal_trace (line 49) | def cal_trace(self, x): method reset (line 61) | def reset(self): FILE: braincog/base/learningrule/STDP.py class STDP (line 20) | class STDP(nn.Module): method __init__ (line 25) | def __init__(self, node, connection, decay=0.99): method forward (line 37) | def forward(self, x): method cal_trace (line 55) | def cal_trace(self, x): method reset (line 66) | def reset(self): class MutliInputSTDP (line 73) | class MutliInputSTDP(nn.Module): method __init__ (line 78) | def __init__(self, node, connection, decay=0.99): method forward (line 90) | def forward(self, *x): method cal_trace (line 112) | def cal_trace(self, x): method reset (line 124) | def reset(self): class LTP (line 131) | class LTP(MutliInputSTDP): class LTD (line 138) | class LTD(nn.Module): method __init__ (line 143) | def __init__(self, node, connection, decay=0.99): method forward (line 155) | def forward(self, *x): method cal_trace (line 174) | def cal_trace(self, x): method reset (line 186) | def reset(self): class FullSTDP (line 193) | class FullSTDP(nn.Module): method __init__ (line 198) | def __init__(self, node, connection, decay=0.99, decay2=0.99): method forward (line 212) | def forward(self, *x): method cal_tracein (line 239) | def cal_tracein(self, x): method cal_traceout (line 251) | def cal_traceout(self, x): method reset (line 263) | def reset(self): FILE: braincog/base/learningrule/STP.py class short_time (line 4) | class short_time(): method __init__ (line 11) | def __init__(self, SizeHistOutput): method syndepr (line 16) | def syndepr(self, Syn=None, ISI=None, Nsp=None): method set_gsyn (line 31) | def set_gsyn(self, np=None, dt=None, v=None, NoiseSyn=None): method IDderiv (line 74) | def IDderiv(self, np=None, v=None, dt=None, dv=None, NoiseSyn=None, fl... method update (line 146) | def update(self, np=None, dt=None, NoiseSyn=None, flag_dv=None): FILE: braincog/base/node/node.py class BaseNode (line 25) | class BaseNode(nn.Module, abc.ABC): method __init__ (line 42) | def __init__(self, method calc_spike (line 72) | def calc_spike(self): method integral (line 80) | def integral(self, inputs): method get_thres (line 90) | def get_thres(self): method rearrange2node (line 93) | def rearrange2node(self, inputs): method rearrange2op (line 118) | def rearrange2op(self, inputs): method forward (line 141) | def forward(self, inputs): method n_reset (line 199) | def n_reset(self): method get_n_attr (line 208) | def get_n_attr(self, attr): method set_n_warm_up (line 215) | def set_n_warm_up(self, flag): method set_n_threshold (line 223) | def set_n_threshold(self, thresh): method set_n_tau (line 231) | def set_n_tau(self, tau): class BaseMCNode (line 244) | class BaseMCNode(nn.Module, abc.ABC): method __init__ (line 251) | def __init__(self, method calc_spike (line 267) | def calc_spike(self): method integral (line 270) | def integral(self, inputs): method forward (line 273) | def forward(self, inputs: dict): method n_reset (line 285) | def n_reset(self): method get_n_fire_rate (line 290) | def get_n_fire_rate(self): method set_n_warm_up (line 295) | def set_n_warm_up(self, flag): method set_n_threshold (line 298) | def set_n_threshold(self, thresh): class ThreeCompNode (line 302) | class ThreeCompNode(BaseMCNode): method __init__ (line 313) | def __init__(self, method integral (line 329) | def integral(self, basal_inputs, apical_inputs): method calc_spike (line 341) | def calc_spike(self): class ReLUNode (line 351) | class ReLUNode(BaseNode): method __init__ (line 356) | def __init__(self, method forward (line 362) | def forward(self, x): method calc_spike (line 375) | def calc_spike(self): class BiasReLUNode (line 379) | class BiasReLUNode(BaseNode): method __init__ (line 384) | def __init__(self, method forward (line 390) | def forward(self, x): method calc_spike (line 396) | def calc_spike(self): class IFNode (line 402) | class IFNode(BaseNode): method __init__ (line 419) | def __init__(self, threshold=.5, act_fun=AtanGrad, *args, **kwargs): method integral (line 431) | def integral(self, inputs): method calc_spike (line 434) | def calc_spike(self): class LIFNode (line 439) | class LIFNode(BaseNode): method __init__ (line 457) | def __init__(self, threshold=0.5, tau=2., act_fun=QGateGrad, *args, **... method integral (line 467) | def integral(self, inputs): method calc_spike (line 470) | def calc_spike(self): class BurstLIFNode (line 475) | class BurstLIFNode(LIFNode): method __init__ (line 476) | def __init__(self, threshold=.5, tau=2., act_fun=RoundGrad, *args, **k... method calc_spike (line 480) | def calc_spike(self): class BackEINode (line 486) | class BackEINode(BaseNode): method __init__ (line 496) | def __init__(self, threshold=0.5, decay=0.2, act_fun=BackEIGateGrad, t... method integral (line 515) | def integral(self, inputs): method calc_spike (line 525) | def calc_spike(self): method n_reset (line 535) | def n_reset(self): class NoiseLIFNode (line 542) | class NoiseLIFNode(LIFNode): method __init__ (line 563) | def __init__(self, method integral (line 583) | def integral(self, inputs): # b, c, w, h / b, c class BiasLIFNode (line 594) | class BiasLIFNode(BaseNode): method __init__ (line 614) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 621) | def integral(self, inputs): method calc_spike (line 624) | def calc_spike(self): class LIFSTDPNode (line 629) | class LIFSTDPNode(BaseNode): method __init__ (line 634) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 641) | def integral(self, inputs): method calc_spike (line 644) | def calc_spike(self): method requires_activation (line 649) | def requires_activation(self): class PLIFNode (line 653) | class PLIFNode(BaseNode): method __init__ (line 672) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 680) | def integral(self, inputs): method calc_spike (line 683) | def calc_spike(self): class PSU (line 688) | class PSU(BaseNode): method __init__ (line 689) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 703) | def integral(self, inputs): method calc_spike (line 707) | def calc_spike(self): class IPSU (line 711) | class IPSU(BaseNode): method masked_weight (line 712) | def masked_weight(self): method __init__ (line 715) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 736) | def integral(self, inputs): method calc_spike (line 740) | def calc_spike(self): class RPSU (line 744) | class RPSU(BaseNode): method masked_weight (line 745) | def masked_weight(self): method __init__ (line 748) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 769) | def integral(self, inputs): method calc_spike (line 774) | def calc_spike(self): class SPSN (line 778) | class SPSN(BaseNode): method __init__ (line 779) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 790) | def integral(self, inputs): method calc_spike (line 793) | def calc_spike(self): class NoisePLIFNode (line 797) | class NoisePLIFNode(PLIFNode): method __init__ (line 815) | def __init__(self, method integral (line 835) | def integral(self, inputs): # b, c, w, h / b, c class BiasPLIFNode (line 845) | class BiasPLIFNode(BaseNode): method __init__ (line 863) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 871) | def integral(self, inputs): method calc_spike (line 874) | def calc_spike(self): class DoubleSidePLIFNode (line 879) | class DoubleSidePLIFNode(LIFNode): method __init__ (line 897) | def __init__(self, method calc_spike (line 908) | def calc_spike(self): class IzhNode (line 913) | class IzhNode(BaseNode): method __init__ (line 926) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 949) | def integral(self, inputs): method calc_spike (line 953) | def calc_spike(self): method n_reset (line 958) | def n_reset(self): class IzhNodeMU (line 964) | class IzhNodeMU(BaseNode): method __init__ (line 977) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 991) | def integral(self, inputs): method calc_spike (line 995) | def calc_spike(self): method n_reset (line 1000) | def n_reset(self): method requires_activation (line 1005) | def requires_activation(self): class DGLIFNode (line 1009) | class DGLIFNode(BaseNode): method __init__ (line 1016) | def __init__(self, threshold=.5, tau=2., *args, **kwargs): method integral (line 1021) | def integral(self, inputs): method calc_spike (line 1025) | def calc_spike(self): class HTDGLIFNode (line 1035) | class HTDGLIFNode(IFNode): method __init__ (line 1042) | def __init__(self, threshold=.5, tau=2., *args, **kwargs): method calc_spike (line 1046) | def calc_spike(self): method forward (line 1058) | def forward(self, inputs): class SimHHNode (line 1065) | class SimHHNode(BaseNode): method __init__ (line 1078) | def __init__(self, threshold=50., tau=2., act_fun=AtanGrad, *args, **k... method integral (line 1093) | def integral(self, inputs): method calc_spike (line 1116) | def calc_spike(self): method forward (line 1120) | def forward(self, inputs): method n_reset (line 1125) | def n_reset(self): method requires_activation (line 1130) | def requires_activation(self): class CTIzhNode (line 1134) | class CTIzhNode(IzhNode): method __init__ (line 1135) | def __init__(self, threshold=1., tau=2., act_fun=AtanGrad, *args, **kw... method integral (line 1163) | def integral(self, inputs): method calc_spike (line 1168) | def calc_spike(self): method spreadMarkPostNeurons (line 1175) | def spreadMarkPostNeurons(self): class adth (line 1183) | class adth(BaseNode): method __init__ (line 1190) | def __init__(self, *args, **kwargs): method adthNode (line 1193) | def adthNode(self, v, dt, c_m, g_m, alpha_w, ad, Ieff, Ichem, Igap, ta... method calc_spike (line 1207) | def calc_spike(self): class HHNode (line 1211) | class HHNode(BaseNode): method __init__ (line 1218) | def __init__(self, p, dt, device, act_fun=AtanGrad, *args, **kwargs): method integral (line 1251) | def integral(self, inputs): method calc_spike (line 1271) | def calc_spike(self): method forward (line 1274) | def forward(self, inputs): method requires_activation (line 1279) | def requires_activation(self): class aEIF (line 1283) | class aEIF(BaseNode): method __init__ (line 1291) | def __init__(self, p, dt, device, *args, **kwargs): method integral (line 1321) | def integral(self, inputs): method calc_spike (line 1331) | def calc_spike(self): method forward (line 1337) | def forward(self, inputs): class LIAFNode (line 1345) | class LIAFNode(BaseNode): method __init__ (line 1353) | def __init__(self, spike_act=BackEIGateGrad(), act_fun="SELU", thresho... method integral (line 1362) | def integral(self, inputs): method calc_spike (line 1365) | def calc_spike(self): class OnlineLIFNode (line 1376) | class OnlineLIFNode(BaseNode): method __init__ (line 1387) | def __init__(self, threshold=0.5, tau=2., act_fun=QGateGrad, init=Fals... method integral (line 1397) | def integral(self, inputs): method calc_spike (line 1403) | def calc_spike(self): class AdaptiveNode (line 1412) | class AdaptiveNode(LIFNode): method __init__ (line 1414) | def __init__(self, threshold=1., act_fun=QGateGrad, step=10, spike_out... method init_weight (line 1459) | def init_weight(self): method forward (line 1466) | def forward(self, inputs): # (t b) c w h method n_reset (line 1500) | def n_reset(self): FILE: braincog/base/strategy/LateralInhibition.py class LateralInhibition (line 7) | class LateralInhibition(nn.Module): method __init__ (line 11) | def __init__(self, node, inh, mode="constant"): method forward (line 17) | def forward(self, x: torch.Tensor, xori=None): FILE: braincog/base/strategy/surrogate.py function heaviside (line 8) | def heaviside(x): class SurrogateFunctionBase (line 12) | class SurrogateFunctionBase(nn.Module): method __init__ (line 19) | def __init__(self, alpha, requires_grad=True): method act_fun (line 26) | def act_fun(x, alpha): method forward (line 34) | def forward(self, x): class sigmoid (line 47) | class sigmoid(torch.autograd.Function): method forward (line 62) | def forward(ctx, x, alpha): method backward (line 69) | def backward(ctx, grad_output): class SigmoidGrad (line 77) | class SigmoidGrad(SurrogateFunctionBase): method __init__ (line 78) | def __init__(self, alpha=1., requires_grad=False): method act_fun (line 82) | def act_fun(x, alpha): class atan (line 91) | class atan(torch.autograd.Function): method forward (line 106) | def forward(ctx, inputs, alpha): method backward (line 111) | def backward(ctx, grad_output): class AtanGrad (line 126) | class AtanGrad(SurrogateFunctionBase): method __init__ (line 127) | def __init__(self, alpha=2., requires_grad=True): method act_fun (line 131) | def act_fun(x, alpha): class gate (line 140) | class gate(torch.autograd.Function): method forward (line 155) | def forward(ctx, x, alpha): method backward (line 162) | def backward(ctx, grad_output): class GateGrad (line 169) | class GateGrad(SurrogateFunctionBase): method __init__ (line 170) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 174) | def act_fun(x, alpha): class quadratic_gate (line 183) | class quadratic_gate(torch.autograd.Function): method forward (line 208) | def forward(ctx, x, alpha): method backward (line 217) | def backward(ctx, grad_output): class QGateGrad (line 224) | class QGateGrad(SurrogateFunctionBase): method __init__ (line 225) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 229) | def act_fun(x, alpha): class relu_like (line 233) | class relu_like(torch.autograd.Function): method forward (line 235) | def forward(ctx, x, alpha): method backward (line 241) | def backward(ctx, grad_output): class RoundGrad (line 250) | class RoundGrad(nn.Module): method __init__ (line 251) | def __init__(self, **kwargs): method forward (line 255) | def forward(self, x): class ReLUGrad (line 259) | class ReLUGrad(SurrogateFunctionBase): method __init__ (line 264) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 268) | def act_fun(x, alpha): class straight_through_estimator (line 277) | class straight_through_estimator(torch.autograd.Function): method forward (line 284) | def forward(ctx, inputs): method backward (line 290) | def backward(ctx, grad_output): class stdp (line 297) | class stdp(torch.autograd.Function): method forward (line 299) | def forward(ctx, inputs): method backward (line 305) | def backward(ctx, grad_output): class STDPGrad (line 310) | class STDPGrad(SurrogateFunctionBase): method __init__ (line 311) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 315) | def act_fun(x, alpha): class backeigate (line 322) | class backeigate(torch.autograd.Function): method forward (line 324) | def forward(ctx, input): method backward (line 329) | def backward(ctx, grad_output): class BackEIGateGrad (line 336) | class BackEIGateGrad(SurrogateFunctionBase): method __init__ (line 337) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 341) | def act_fun(x, alpha): class ei (line 344) | class ei(torch.autograd.Function): method forward (line 346) | def forward(ctx, input): method backward (line 351) | def backward(ctx, grad_output): class EIGrad (line 358) | class EIGrad(SurrogateFunctionBase): method __init__ (line 359) | def __init__(self, alpha=2., requires_grad=False): method act_fun (line 363) | def act_fun(x, alpha): FILE: braincog/base/utils/__init__.py function drop_path (line 12) | def drop_path(x, drop_prob): FILE: braincog/base/utils/criterions.py class UnilateralMse (line 5) | class UnilateralMse(torch.nn.Module): method __init__ (line 10) | def __init__(self, thresh=1.): method forward (line 15) | def forward(self, x, target): class MixLoss (line 23) | class MixLoss(torch.nn.Module): method __init__ (line 28) | def __init__(self, ce_loss): method forward (line 33) | def forward(self, x, target): class TetLoss (line 37) | class TetLoss(torch.nn.Module): method __init__ (line 38) | def __init__(self, loss_fn): method forward (line 42) | def forward(self, x, target): class OnehotMse (line 50) | class OnehotMse(torch.nn.Module): method __init__ (line 54) | def __init__(self, num_class): method forward (line 59) | def forward(self, x, target): FILE: braincog/base/utils/visualization.py function spike_rate_vis_1d (line 31) | def spike_rate_vis_1d(data, output_dir=''): function spike_rate_vis (line 46) | def spike_rate_vis(data, output_dir=''): function plot_mem_distribution (line 61) | def plot_mem_distribution(data, function plot_tsne (line 113) | def plot_tsne(x, colors,output_dir="", num_classes=None): function plot_tsne_3d (line 141) | def plot_tsne_3d(x, colors,output_dir="", num_classes=None): function plot_confusion_matrix (line 178) | def plot_confusion_matrix(logits, labels, output_dir): FILE: braincog/datasets/CUB2002011.py class CUB2002011 (line 9) | class CUB2002011(VisionDataset): method __init__ (line 29) | def __init__(self, root, train=True, transform=None, target_transform=... method _load_metadata (line 40) | def _load_metadata(self): method _check_integrity (line 59) | def _check_integrity(self): method _download (line 72) | def _download(self): method __len__ (line 84) | def __len__(self): method __getitem__ (line 87) | def __getitem__(self, idx): FILE: braincog/datasets/ESimagenet/ES_imagenet.py class ESImagenet_Dataset (line 13) | class ESImagenet_Dataset(data.Dataset): method __init__ (line 14) | def __init__(self, mode, data_set_path='/data/dvsimagenet/', transform... method __getitem__ (line 39) | def __getitem__(self, index): method __len__ (line 74) | def __len__(self): FILE: braincog/datasets/ESimagenet/reconstructed_ES_imagenet.py class ESImagenet2D_Dataset (line 14) | class ESImagenet2D_Dataset(data.Dataset): method __init__ (line 15) | def __init__(self, mode, data_set_path='/data/ESimagenet-0.18/', trans... method __getitem__ (line 44) | def __getitem__(self, index): method __len__ (line 90) | def __len__(self): FILE: braincog/datasets/NOmniglot/NOmniglot.py class NOmniglot (line 5) | class NOmniglot(Dataset): method __init__ (line 6) | def __init__(self, root='data/', frames_num=12, train=True, data_type=... method __len__ (line 40) | def __len__(self): method __getitem__ (line 43) | def __getitem__(self, index): method readimage (line 48) | def readimage(self, image, label): FILE: braincog/datasets/NOmniglot/nomniglot_full.py class NOmniglotfull (line 6) | class NOmniglotfull(Dataset): method __init__ (line 12) | def __init__(self, root='data/', train=True, frames_num=4, data_type='... method __len__ (line 29) | def __len__(self): method __getitem__ (line 32) | def __getitem__(self, index): FILE: braincog/datasets/NOmniglot/nomniglot_nw_ks.py class NOmniglotNWayKShot (line 8) | class NOmniglotNWayKShot(Dataset): method __init__ (line 15) | def __init__(self, root, n_way, k_shot, k_query, train=True, frames_nu... method load_data_cache (line 26) | def load_data_cache(self, data_dict, length): method __getitem__ (line 51) | def __getitem__(self, index): method reset (line 65) | def reset(self): method __len__ (line 68) | def __len__(self): FILE: braincog/datasets/NOmniglot/nomniglot_pair.py class NOmniglotTrainSet (line 10) | class NOmniglotTrainSet(Dataset): method __init__ (line 16) | def __init__(self, root='data/', use_frame=True, frames_num=10, data_t... method __len__ (line 26) | def __len__(self): method __getitem__ (line 32) | def __getitem__(self, index): class NOmniglotTestSet (line 68) | class NOmniglotTestSet(Dataset): method __init__ (line 74) | def __init__(self, root='data/', time=1000, way=20, shot=1, query=1, u... method __len__ (line 93) | def __len__(self): method __getitem__ (line 100) | def __getitem__(self, index): FILE: braincog/datasets/NOmniglot/utils.py class FunctionThread (line 9) | class FunctionThread(threading.Thread): method __init__ (line 10) | def __init__(self, f, *args, **kwargs): method run (line 16) | def run(self): function integrate_events_to_frames (line 20) | def integrate_events_to_frames(events, height, width, frames_num=10, dat... function normalize_frame (line 71) | def normalize_frame(frames: np.ndarray or torch.Tensor, normalization: s... function convert_events_dir_to_frames_dir (line 91) | def convert_events_dir_to_frames_dir(events_data_dir, frames_data_dir, s... function convert_aedat4_dir_to_events_dir (line 135) | def convert_aedat4_dir_to_events_dir(root, train): function num2str (line 178) | def num2str(idx): function list_all_files (line 184) | def list_all_files(root, suffix, getlen=False): function list_class_files (line 207) | def list_class_files(root, frames_kind_root, getlen=False, use_npz=False): FILE: braincog/datasets/StanfordDogs.py class StanfordDogs (line 9) | class StanfordDogs(VisionDataset): method __init__ (line 25) | def __init__(self, root, train=True, transform=None, target_transform=... method __len__ (line 44) | def __len__(self): method __getitem__ (line 47) | def __getitem__(self, index): method download (line 58) | def download(self): method load_split (line 75) | def load_split(self): method stats (line 87) | def stats(self): FILE: braincog/datasets/TinyImageNet.py class TinyImageNet (line 12) | class TinyImageNet(VisionDataset): method __init__ (line 30) | def __init__(self, root, split='train', transform=None, target_transfo... method _download (line 52) | def _download(self): method _check_integrity (line 58) | def _check_integrity(self): method __getitem__ (line 61) | def __getitem__(self, index): method __len__ (line 72) | def __len__(self): function find_classes (line 76) | def find_classes(class_file): function make_dataset (line 86) | def make_dataset(root, base_folder, dirname, class_to_idx): FILE: braincog/datasets/__init__.py function is_dvs_data (line 33) | def is_dvs_data(dataset): FILE: braincog/datasets/bullying10k/bullying10k.py class BULLYINGDVS (line 11) | class BULLYINGDVS(Dataset): method __init__ (line 20) | def __init__(self, save_to, transform=None, target_transform=None): method __getitem__ (line 40) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method __len__ (line 67) | def __len__(self): method _check_exists (line 70) | def _check_exists(self): FILE: braincog/datasets/cut_mix.py function event_difference (line 11) | def event_difference(x1, x2, kernel_size=3): function onehot (line 18) | def onehot(size, target): function rand_bbox_time (line 24) | def rand_bbox_time(size, rat): function rand_bbox (line 38) | def rand_bbox(size, rat): function calc_lam (line 61) | def calc_lam(x1, x2, bbt1, bbt2, bbx1, bbx2, bby1, bby2): function rand_bbox_st (line 72) | def rand_bbox_st(size, rat): function spatio_mask (line 80) | def spatio_mask(size, rat): function temporal_mask (line 94) | def temporal_mask(size, rat): function st_mask (line 101) | def st_mask(size, rat): function GMM_mask_clip (line 112) | def GMM_mask_clip(size, rat): function GMM_mask (line 123) | def GMM_mask(size, rat, n=None): function calc_masked_lam (line 188) | def calc_masked_lam(x1, x2, mask): function calc_masked_lam_with_difference (line 200) | def calc_masked_lam_with_difference(x1, x2, mix, kernel_size=3): class MixUp (line 206) | class MixUp(Dataset): method __init__ (line 207) | def __init__(self, dataset, num_class, num_mix=1, beta=1., prob=1.0, i... method __getitem__ (line 217) | def __getitem__(self, index): method __len__ (line 251) | def __len__(self): class CutMix (line 255) | class CutMix(Dataset): method __init__ (line 257) | def __init__(self, dataset, num_class, num_mix=1, beta=1., prob=1.0, i... method __getitem__ (line 267) | def __getitem__(self, index): method __len__ (line 333) | def __len__(self): class EventMix (line 337) | class EventMix(Dataset): method __init__ (line 339) | def __init__(self, method __getitem__ (line 361) | def __getitem__(self, index): method __len__ (line 420) | def __len__(self): function get_proj (line 430) | def get_proj(self): FILE: braincog/datasets/datasets.py function unpack_mix_param (line 48) | def unpack_mix_param(args): function build_transform (line 61) | def build_transform(is_train, img_size): function build_dataset (line 105) | def build_dataset(is_train, img_size, dataset, path, same_da=False): class MNISTData (line 131) | class MNISTData(object): method __init__ (line 136) | def __init__(self, method get_data_loaders (line 153) | def get_data_loaders(self): method get_standard_data (line 167) | def get_standard_data(self): function get_mnist_data (line 178) | def get_mnist_data(batch_size, num_workers=8, same_da=False,root=DATA_DI... function get_fashion_data (line 225) | def get_fashion_data(batch_size, num_workers=8, same_da=False,root=DATA_... function get_cifar10_data (line 258) | def get_cifar10_data(batch_size, num_workers=8, same_da=False,root=DATA_... function get_cifar100_data (line 283) | def get_cifar100_data(batch_size, num_workers=8, same_data=False,root=DA... function get_TinyImageNet_data (line 305) | def get_TinyImageNet_data(batch_size, num_workers=8, same_da=False,root=... function get_imnet_data (line 338) | def get_imnet_data(args, _logger, data_config, num_aug_splits,root=DATA_... function get_dvsg_data (line 428) | def get_dvsg_data(batch_size, step,root=DATA_DIR, **kwargs): function get_bullyingdvs_data (line 528) | def get_bullyingdvs_data(batch_size, step, root=DATA_DIR, **kwargs): function get_dvsc10_data (line 634) | def get_dvsc10_data(batch_size, step, root=DATA_DIR, **kwargs): function get_NCALTECH101_data (line 755) | def get_NCALTECH101_data(batch_size, step,root=DATA_DIR, **kwargs): function get_NCARS_data (line 884) | def get_NCARS_data(batch_size, step,root=DATA_DIR, **kwargs): function get_nomni_data (line 982) | def get_nomni_data(batch_size, train_portion=1.,root=DATA_DIR, **kwargs): function get_esimnet_data (line 1045) | def get_esimnet_data(batch_size, step,root=DATA_DIR, **kwargs): function get_nmnist_data (line 1133) | def get_nmnist_data(batch_size, step, **kwargs): function get_ntidigits_data (line 1233) | def get_ntidigits_data(batch_size, step, **kwargs): function get_shd_data (line 1277) | def get_shd_data(batch_size, step, **kwargs): function get_CUB2002011_data (line 1333) | def get_CUB2002011_data(batch_size, num_workers=8, same_da=False,root=DA... function get_StanfordCars_data (line 1364) | def get_StanfordCars_data(batch_size, num_workers=8, same_da=False,root=... function get_StanfordDogs_data (line 1395) | def get_StanfordDogs_data(batch_size, num_workers=8, same_da=False,root=... function get_FGVCAircraft_data (line 1427) | def get_FGVCAircraft_data(batch_size, num_workers=8, same_da=False,root=... function get_Flowers102_data (line 1459) | def get_Flowers102_data(batch_size, num_workers=8, same_da=False,root=DA... function get_UCF101DVS_data (line 1491) | def get_UCF101DVS_data(batch_size, step, **kwargs): function get_HMDBDVS_data (line 1597) | def get_HMDBDVS_data(batch_size, step, **kwargs): FILE: braincog/datasets/hmdb_dvs/hmdb_dvs.py class HMDBDVS (line 18) | class HMDBDVS(Dataset): method __init__ (line 40) | def __init__(self, save_to, transform=None, target_transform=None): method __getitem__ (line 69) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method __len__ (line 90) | def __len__(self): method _check_exists (line 93) | def _check_exists(self): FILE: braincog/datasets/ncaltech101/ncaltech101.py class NCALTECH101 (line 17) | class NCALTECH101(Dataset): method __init__ (line 60) | def __init__(self, save_to, transform=None, target_transform=None): method __getitem__ (line 187) | def __getitem__(self, index): method __len__ (line 202) | def __len__(self): method _check_exists (line 205) | def _check_exists(self): FILE: braincog/datasets/rand_aug.py function ShearX (line 9) | def ShearX(x, v): # [-0.3, 0.3] function ShearY (line 17) | def ShearY(x, v): # [-0.3, 0.3] function TranslateX (line 25) | def TranslateX(x, v): function TranslateY (line 35) | def TranslateY(x, v): function Rotate (line 45) | def Rotate(x, v): # [-30, 30] function CutoutAbs (line 53) | def CutoutAbs(x, v): # [0, 60] => percentage: [0, 0.2] function CutoutTemporal (line 70) | def CutoutTemporal(x, v): function TemporalShift (line 81) | def TemporalShift(x, v): function SpatioShift (line 115) | def SpatioShift(x, v): function drop (line 133) | def drop(x, v): function GaussianBlur (line 147) | def GaussianBlur(x, v): function SaltAndPepperNoise (line 153) | def SaltAndPepperNoise(x, v): function Identity (line 161) | def Identity(x, v): class RandAugment (line 182) | class RandAugment: method __init__ (line 183) | def __init__(self, n, m): method __call__ (line 188) | def __call__(self, x): FILE: braincog/datasets/ucf101_dvs/ucf101_dvs.py class UCF101DVS (line 27) | class UCF101DVS(Dataset): method __init__ (line 49) | def __init__(self, save_to, train=False, transform=None, target_transf... method __getitem__ (line 80) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method __len__ (line 101) | def __len__(self): method _check_exists (line 104) | def _check_exists(self): FILE: braincog/datasets/utils.py function rescale (line 6) | def rescale(x, factor=None): function dvs_channel_check_expend (line 20) | def dvs_channel_check_expend(x): FILE: braincog/model_zoo/NeuEvo/__init__.py function parse (line 25) | def parse(weights, operation_set, function parse_genotype (line 142) | def parse_genotype(alphas, steps, multiplier, path=None, FILE: braincog/model_zoo/NeuEvo/architect.py function normalize (line 9) | def normalize(x): function _concat (line 15) | def _concat(xs): class Architect (line 19) | class Architect(object): method __init__ (line 20) | def __init__(self, model, args): method step (line 33) | def step(self, input_valid, target_valid): method compute_Hw (line 43) | def compute_Hw(self, input_valid, target_valid): method zero_grads (line 52) | def zero_grads(self, parameters): method compute_eigenvalues (line 58) | def compute_eigenvalues(self): method _hessian (line 62) | def _hessian(self, outputs, inputs, out=None, allow_unused=False): FILE: braincog/model_zoo/NeuEvo/model.py class MlpCell (line 13) | class MlpCell(BaseModule): method __init__ (line 14) | def __init__( method _compile (line 50) | def _compile(self, C, op_names, indices, concat): method _forward_once (line 81) | def _forward_once(self, s0, s1, drop_prob): method forward (line 111) | def forward(self, inputs): class Cell (line 126) | class Cell(nn.Module): method __init__ (line 127) | def __init__(self, genotype, C_prev_prev, C_prev, C, reduction, reduct... method _compile (line 151) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 183) | def forward(self, s0, s1, drop_prob): class DCOCell (line 216) | class DCOCell(nn.Module): method __init__ (line 217) | def __init__(self, genotype, C_prev_prev, C_prev, C, reduction, reduct... method _compile (line 233) | def _compile(self, C, op_names, tos, froms, reduction): method forward (line 252) | def forward(self, s0, s1, drop_prob): class AuxiliaryHeadCIFAR (line 280) | class AuxiliaryHeadCIFAR(nn.Module): method __init__ (line 281) | def __init__(self, C, num_classes, act_fun): method forward (line 301) | def forward(self, x): class AuxiliaryHeadImageNet (line 307) | class AuxiliaryHeadImageNet(nn.Module): method __init__ (line 309) | def __init__(self, C, num_classes): method forward (line 326) | def forward(self, x): class NetworkCIFAR (line 333) | class NetworkCIFAR(BaseModule): method __init__ (line 335) | def __init__(self, method forward (line 436) | def forward(self, inputs): class NetworkImageNet (line 474) | class NetworkImageNet(BaseModule): method __init__ (line 476) | def __init__(self, method forward (line 549) | def forward(self, inputs): FILE: braincog/model_zoo/NeuEvo/model_search.py function calc_weight (line 15) | def calc_weight(x): function calc_loss (line 27) | def calc_loss(x): class darts_fun (line 39) | class darts_fun(torch.autograd.Function): method forward (line 41) | def forward(ctx, inputs, weights): # feature map / arch weight method backward (line 47) | def backward(ctx, grad_output): # error signal class MixedOp (line 64) | class MixedOp(nn.Module): method __init__ (line 65) | def __init__(self, C, stride, act_fun): method forward (line 76) | def forward(self, x, weights): class Cell (line 84) | class Cell(nn.Module): method __init__ (line 86) | def __init__(self, steps, multiplier, C_prev_prev, C_prev, C, reductio... method forward (line 121) | def forward(self, s0, s1, weights): class Network (line 153) | class Network(BaseModule): method __init__ (line 155) | def __init__(self, C, num_classes, layers, criterion, steps=4, multipl... method new (line 228) | def new(self): method forward (line 235) | def forward(self, inputs): method reset_fire_rate_record (line 261) | def reset_fire_rate_record(self): method get_fire_per_step (line 265) | def get_fire_per_step(self): method _loss (line 268) | def _loss(self, input1, target1, input2): method _initialize_alphas (line 275) | def _initialize_alphas(self): method arch_parameters (line 301) | def arch_parameters(self): method genotype (line 304) | def genotype(self): method states (line 317) | def states(self): method restore (line 324) | def restore(self, states): method update_history (line 328) | def update_history(self): FILE: braincog/model_zoo/NeuEvo/operations.py function si_relu (line 15) | def si_relu(x, positive): class SiReLU (line 26) | class SiReLU(nn.Module): method __init__ (line 27) | def __init__(self, positive=0): method forward (line 31) | def forward(self, x): function weight_init (line 35) | def weight_init(m): class SiMLP (line 154) | class SiMLP(nn.Module): method __init__ (line 155) | def __init__(self, c_in, c_out, act_fun=nn.ReLU, positive=0, *args, **... method forward (line 163) | def forward(self, x): class ReLUConvBN (line 168) | class ReLUConvBN(nn.Module): method __init__ (line 173) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 186) | def forward(self, x): class DilConv (line 191) | class DilConv(nn.Module): method __init__ (line 196) | def __init__(self, C_in, C_out, kernel_size, stride, padding, dilation... method forward (line 210) | def forward(self, x): class SepConv (line 215) | class SepConv(nn.Module): method __init__ (line 217) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 236) | def forward(self, x): class Identity (line 241) | class Identity(nn.Module): method __init__ (line 243) | def __init__(self, positive=0): method forward (line 247) | def forward(self, x): class Zero (line 251) | class Zero(nn.Module): method __init__ (line 253) | def __init__(self, stride): method forward (line 257) | def forward(self, x): class FactorizedReduce (line 263) | class FactorizedReduce(nn.Module): method __init__ (line 265) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 279) | def forward(self, x): class DeformConv (line 288) | class DeformConv(nn.Module): method __init__ (line 289) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 302) | def forward(self, x): class Attention (line 307) | class Attention(Module): method __init__ (line 312) | def __init__(self, dim, num_heads=4, attention_dropout=0.1, projection... method forward (line 323) | def forward(self, x): class TransformerEncoderLayer (line 339) | class TransformerEncoderLayer(Module): method __init__ (line 345) | def __init__(self, d_model, nhead=4, dim_feedforward=256, dropout=0.1, method forward (line 363) | def forward(self, src: torch.Tensor, *args, **kwargs) -> torch.Tensor: function drop_path (line 376) | def drop_path(x, drop_prob: float = 0., training: bool = False): class DropPath (line 398) | class DropPath(Module): method __init__ (line 404) | def __init__(self, drop_prob=None): method forward (line 408) | def forward(self, x): FILE: braincog/model_zoo/NeuEvo/others.py class CIFARNet_Wu (line 22) | class CIFARNet_Wu(BaseModule): method __init__ (line 24) | def __init__( method forward (line 67) | def forward(self, inputs): class CIFARNet_Fang (line 79) | class CIFARNet_Fang(BaseModule): method __init__ (line 81) | def __init__( method forward (line 119) | def forward(self, inputs): class DVS_CIFARNet_Fang (line 132) | class DVS_CIFARNet_Fang(BaseModule): method __init__ (line 134) | def __init__( method forward (line 172) | def forward(self, inputs): FILE: braincog/model_zoo/backeinet.py class MNISTNet (line 8) | class MNISTNet(BaseModule): method __init__ (line 9) | def __init__(self, step=20, encode_type='rate', if_back=True, if_ei=Tr... method forward (line 39) | def forward(self, inputs): class CIFARNet (line 54) | class CIFARNet(BaseModule): method __init__ (line 55) | def __init__(self, step=20, encode_type='rate', if_back=True, if_ei=Tr... method forward (line 84) | def forward(self, inputs): FILE: braincog/model_zoo/base_module.py class BaseLinearModule (line 8) | class BaseLinearModule(nn.Module): method __init__ (line 18) | def __init__(self, method forward (line 43) | def forward(self, x): class BaseConvModule (line 58) | class BaseConvModule(nn.Module): method __init__ (line 70) | def __init__(self, method forward (line 100) | def forward(self, x): class BaseModule (line 113) | class BaseModule(nn.Module, abc.ABC): method __init__ (line 123) | def __init__(self, method reset (line 151) | def reset(self): method set_attr (line 160) | def set_attr(self, attr, val): method get_threshold (line 174) | def get_threshold(self): method get_fp (line 186) | def get_fp(self, temporal_info=False): method get_mem (line 201) | def get_mem(self, temporal_info=False): method get_fire_rate (line 216) | def get_fire_rate(self, requires_grad=False): method get_tot_spike (line 235) | def get_tot_spike(self): method get_spike_info (line 250) | def get_spike_info(self): method set_requires_fp (line 276) | def set_requires_fp(self, flag): method set_requires_mem (line 281) | def set_requires_mem(self, flag): method get_attr (line 286) | def get_attr(self, attr): method forward (line 299) | def forward(self, inputs): class DeformConvPack (line 303) | class DeformConvPack(nn.Module): method __init__ (line 304) | def __init__(self, method init_weights (line 342) | def init_weights(self): method forward (line 347) | def forward(self, x): FILE: braincog/model_zoo/bdmsnn.py class BDMSNN (line 17) | class BDMSNN(nn.Module): method __init__ (line 18) | def __init__(self, num_state, num_action, weight_exc, weight_inh, node... method forward (line 79) | def forward(self, input): method UpdateWeight (line 100) | def UpdateWeight(self, i, s, num_action, dw): method reset (line 124) | def reset(self): method getweight (line 134) | def getweight(self): FILE: braincog/model_zoo/convnet.py class BaseConvNet (line 12) | class BaseConvNet(BaseModule, abc.ABC): method __init__ (line 13) | def __init__(self, method _create_feature (line 56) | def _create_feature(self): method _create_fc (line 60) | def _create_fc(self): method forward (line 63) | def forward(self, inputs): class MNISTConvNet (line 102) | class MNISTConvNet(BaseConvNet): method __init__ (line 103) | def __init__(self, method _create_feature (line 126) | def _create_feature(self): method _create_fc (line 153) | def _create_fc(self): class CifarConvNet (line 165) | class CifarConvNet(BaseConvNet): method __init__ (line 166) | def __init__(self, method _create_feature (line 188) | def _create_feature(self): method _create_fc (line 220) | def _create_fc(self): function mnist_convnet (line 230) | def mnist_convnet(step, function cifar_convnet (line 255) | def cifar_convnet(step, function dvs_convnet (line 283) | def dvs_convnet(step, FILE: braincog/model_zoo/fc_snn.py class STSC_Attention (line 12) | class STSC_Attention(nn.Module): method __init__ (line 13) | def __init__(self, n_channel: int, dimension: int = 2, time_rf: int = ... method forward (line 34) | def forward(self, x_seq: torch.Tensor): class STSC_Temporal_Conv (line 58) | class STSC_Temporal_Conv(nn.Module): method __init__ (line 59) | def __init__(self, channels: int, dimension: int = 2, time_rf: int = 2): method forward (line 78) | def forward(self, x_seq: torch.Tensor): class STSC (line 93) | class STSC(nn.Module): method __init__ (line 94) | def __init__(self, in_channel: int, dimension: int = 2, time_rf_conv: ... method forward (line 115) | def forward(self, x_seq: torch.Tensor): class SHD_SNN (line 147) | class SHD_SNN(BaseModule): method __init__ (line 153) | def __init__(self, method forward (line 183) | def forward(self, inputs): FILE: braincog/model_zoo/glsnn.py class BaseGLSNN (line 12) | class BaseGLSNN(BaseModule): method __init__ (line 20) | def __init__(self, input_size=784, hidden_sizes=[800] * 3, output_size... method forward (line 41) | def forward(self, x): method feedback (line 57) | def feedback(self, ff_value, y_label): method set_gradient (line 74) | def set_gradient(self, x, y): method forward_parameters (line 94) | def forward_parameters(self): method feedback_parameters (line 100) | def feedback_parameters(self): FILE: braincog/model_zoo/linearNet.py class droDMTrainNet (line 8) | class droDMTrainNet(nn.Module): method __init__ (line 13) | def __init__(self, connection): method forward (line 33) | def forward(self, input): method UpdateWeight (line 44) | def UpdateWeight(self, i, dw): method reset (line 54) | def reset(self): method getweight (line 64) | def getweight(self): FILE: braincog/model_zoo/nonlinearNet.py class droDMTestNet (line 8) | class droDMTestNet(nn.Module): method __init__ (line 13) | def __init__(self, connection): method forward (line 36) | def forward(self, input, input_da): method UpdateWeight (line 49) | def UpdateWeight(self, i, dw): method reset (line 59) | def reset(self): method getweight (line 69) | def getweight(self): FILE: braincog/model_zoo/qsnn.py function sigma (line 34) | def sigma(x): function deriv_sigma (line 41) | def deriv_sigma(x): function kappa (line 52) | def kappa(x): function get_kappas (line 56) | def get_kappas(n): class Net (line 71) | class Net(nn.Module): method __init__ (line 75) | def __init__(self, net_size): method update_state (line 83) | def update_state(self, input_, label, test): method routine (line 95) | def routine(self, method update_weight (line 125) | def update_weight(self, lr, t, beta, eps): method predict (line 134) | def predict(self, class Hidden_layer (line 156) | class Hidden_layer(nn.Module): method __init__ (line 160) | def __init__(self, input_size, neu_num, fb_neus): method update_state (line 179) | def update_state(self, basal_input, apical_input, test): method update_weight (line 185) | def update_weight(self, delta_, lr, t, beta, eps): class Output_layer (line 205) | class Output_layer(nn.Module): method __init__ (line 209) | def __init__(self, input_size, neu_num): method update_state (line 229) | def update_state(self, basal_input, I, test): method update_weight (line 239) | def update_weight(self, lr, t, beta, eps): FILE: braincog/model_zoo/resnet.py function conv3x3 (line 29) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 41) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 50) | class BasicBlock(nn.Module): method __init__ (line 66) | def __init__(self, method forward (line 97) | def forward(self, x): class Bottleneck (line 116) | class Bottleneck(nn.Module): method __init__ (line 132) | def __init__(self, method forward (line 163) | def forward(self, x): class ResNet (line 185) | class ResNet(BaseModule): method __init__ (line 203) | def __init__(self, method _make_layer (line 352) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False, n... method forward (line 389) | def forward(self, inputs): function _resnet (line 446) | def _resnet(arch, block, layers, pretrained=False, **kwargs): function resnet9 (line 456) | def resnet9(pretrained=False, **kwargs): function resnet18 (line 461) | def resnet18(pretrained=False, **kwargs): function resnet34_half (line 467) | def resnet34_half(pretrained=False, **kwargs): function resnet34 (line 474) | def resnet34(pretrained=False, **kwargs): function resnet50_half (line 479) | def resnet50_half(pretrained=False, **kwargs): function resnet50 (line 486) | def resnet50(pretrained=False, **kwargs): function resnet101 (line 491) | def resnet101(pretrained=False, **kwargs): function resnet152 (line 497) | def resnet152(pretrained=False, **kwargs): function resnext50_32x4d (line 503) | def resnext50_32x4d(pretrained=False, **kwargs): function resnext101_32x8d (line 511) | def resnext101_32x8d(pretrained=False, **kwargs): function wide_resnet50_2 (line 519) | def wide_resnet50_2(pretrained=False, **kwargs): function wide_resnet101_2 (line 526) | def wide_resnet101_2(pretrained=False, **kwargs): FILE: braincog/model_zoo/resnet19_snn.py function conv3x3 (line 21) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 27) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 32) | class BasicBlock(nn.Module): method __init__ (line 35) | def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, method forward (line 54) | def forward(self, x): class ResNet (line 74) | class ResNet(BaseModule): method __init__ (line 75) | def __init__(self, block, layers, num_classes=10, zero_init_residual=F... method _make_layer (line 140) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False): method _forward_impl (line 168) | def _forward_impl(self, x): method forward (line 188) | def forward(self, inputs): function _resnet (line 195) | def _resnet(arch, block, layers, pretrained, progress, norm=ThresholdDep... function resnet19 (line 204) | def resnet19(pretrained=False, progress=True, norm=ThresholdDependentBat... FILE: braincog/model_zoo/rsnn.py class RSNN (line 13) | class RSNN(nn.Module): method __init__ (line 14) | def __init__(self,num_state,num_action): method forward (line 36) | def forward(self, input): method UpdateWeight (line 42) | def UpdateWeight(self,reward): method reset (line 49) | def reset(self): method getweight (line 54) | def getweight(self): FILE: braincog/model_zoo/sew_resnet.py function sew_function (line 31) | def sew_function(x: torch.Tensor, y: torch.Tensor, cnf:str): function conv3x3 (line 43) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 49) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 54) | class BasicBlock(nn.Module): method __init__ (line 57) | def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, method forward (line 79) | def forward(self, x): method extra_repr (line 97) | def extra_repr(self) -> str: class Bottleneck (line 100) | class Bottleneck(nn.Module): method __init__ (line 109) | def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, method forward (line 131) | def forward(self, x): method extra_repr (line 153) | def extra_repr(self) -> str: class SEWResNet (line 157) | class SEWResNet(BaseModule): method __init__ (line 158) | def __init__(self, block, layers, num_classes=1000, step=8,encode_type... method _make_layer (line 228) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False, c... method _forward_impl (line 252) | def _forward_impl(self, inputs): method _forward_once (line 308) | def _forward_once(self,x): method forward (line 327) | def forward(self, x): class SEWResNet19 (line 331) | class SEWResNet19(BaseModule): method __init__ (line 332) | def __init__(self, block, layers, num_classes=1000, step=8,encode_type... method _make_layer (line 401) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False, c... method _forward_impl (line 425) | def _forward_impl(self, inputs): method _forward_once (line 479) | def _forward_once(self,x): method forward (line 498) | def forward(self, x): class SEWResNetCifar (line 502) | class SEWResNetCifar(BaseModule): method __init__ (line 503) | def __init__(self, block, layers, num_classes=1000, step=8,encode_type... method _make_layer (line 572) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False, c... method _forward_impl (line 596) | def _forward_impl(self, inputs): method _forward_once (line 648) | def _forward_once(self,x): method forward (line 667) | def forward(self, x): function _sew_resnet (line 672) | def _sew_resnet(arch, block, layers, pretrained, progress, cnf, **kwargs): function sew_resnet19 (line 681) | def sew_resnet19(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet18 (line 701) | def sew_resnet18(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet20 (line 721) | def sew_resnet20(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet32 (line 740) | def sew_resnet32(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet44 (line 759) | def sew_resnet44(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet56 (line 778) | def sew_resnet56(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet34 (line 797) | def sew_resnet34(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet50 (line 817) | def sew_resnet50(pretrained=False, progress=True, cnf: str = None, **kw... function sew_resnet101 (line 837) | def sew_resnet101(pretrained=False, progress=True, cnf: str = None, **k... function sew_resnet152 (line 857) | def sew_resnet152(pretrained=False, progress=True, cnf: str = None, **k... function sew_resnext50_32x4d (line 877) | def sew_resnext50_32x4d(pretrained=False, progress=True, cnf: str = None... function sew_resnext34_32x4d (line 899) | def sew_resnext34_32x4d(pretrained=False, progress=True, cnf: str = None... function sew_resnext101_32x8d (line 920) | def sew_resnext101_32x8d(pretrained=False, progress=True, cnf: str = Non... function sew_wide_resnet50_2 (line 941) | def sew_wide_resnet50_2(pretrained=False, progress=True, cnf: str = None... function sew_wide_resnet101_2 (line 966) | def sew_wide_resnet101_2(pretrained=False, progress=True, cnf: str = Non... FILE: braincog/model_zoo/vgg_snn.py class SNN7_tiny (line 22) | class SNN7_tiny(BaseModule): method __init__ (line 23) | def __init__(self, method forward (line 58) | def forward(self, inputs): class SNN5 (line 80) | class SNN5(BaseModule): method __init__ (line 81) | def __init__(self, method forward (line 120) | def forward(self, inputs): class VGG_SNN (line 142) | class VGG_SNN(BaseModule): method __init__ (line 143) | def __init__(self, method forward (line 183) | def forward(self, inputs): FILE: braincog/utils.py function setup_seed (line 13) | def setup_seed(seed): function random_gradient (line 35) | def random_gradient(model: nn.Module, sigma: float): class AverageMeter (line 49) | class AverageMeter(object): method __init__ (line 50) | def __init__(self): method reset (line 53) | def reset(self): method update (line 58) | def update(self, val, n=1): class TensorGather (line 63) | class TensorGather(object): method __init__ (line 64) | def __init__(self): method reset (line 66) | def reset(self): method update (line 69) | def update(self, val): function accuracy (line 73) | def accuracy(output, target, topk=(1,)): function mse (line 90) | def mse(x, y): function rand_ortho (line 95) | def rand_ortho(shape, irange): function adjust_surrogate_coeff (line 101) | def adjust_surrogate_coeff(epoch, tot_epochs): function save_feature_map (line 111) | def save_feature_map(x, dir=''): function save_spike_info (line 126) | def save_spike_info(fname, epoch, batch_idx, step, avg, var, spike, avg_... function calc_aurc (line 159) | def calc_aurc(confidences, labels): FILE: examples/Embodied_Cognition/RHI/RHI_Test.py class CustomLinear (line 23) | class CustomLinear(nn.Module): method __init__ (line 24) | def __init__(self, weight,mask=None): method forward (line 29) | def forward(self, x: torch.Tensor): method update (line 34) | def update(self, dw): class M1Net (line 40) | class M1Net(nn.Module): method __init__ (line 41) | def __init__(self,connection): method forward (line 47) | def forward(self, input): method reset (line 66) | def reset(self): class VNet (line 70) | class VNet(nn.Module): method __init__ (line 71) | def __init__(self,connection): method forward (line 77) | def forward(self, input): method reset (line 96) | def reset(self): class S1Net (line 100) | class S1Net(nn.Module): method __init__ (line 101) | def __init__(self,connection): method forward (line 107) | def forward(self, input, FR, C): method reset (line 137) | def reset(self): class EBANet (line 141) | class EBANet(nn.Module): method __init__ (line 142) | def __init__(self,connection): method forward (line 148) | def forward(self, input, FR, C): method reset (line 178) | def reset(self): class TPJNet (line 182) | class TPJNet(nn.Module): method __init__ (line 183) | def __init__(self,connection): method forward (line 189) | def forward(self, input, FR, C): method reset (line 219) | def reset(self): method UpdateWeight (line 223) | def UpdateWeight(self, i, W): class AINet (line 226) | class AINet(nn.Module): method __init__ (line 227) | def __init__(self,connection): method forward (line 233) | def forward(self, input, FR, C): method reset (line 263) | def reset(self): method UpdateWeight (line 267) | def UpdateWeight(self, i, W): function DeltaWeight (line 271) | def DeltaWeight(Pre, Pre_n, Post, Post_n): FILE: examples/Embodied_Cognition/RHI/RHI_Train.py class CustomLinear (line 23) | class CustomLinear(nn.Module): method __init__ (line 24) | def __init__(self, weight,mask=None): method forward (line 29) | def forward(self, x: torch.Tensor): method update (line 34) | def update(self, dw): class M1Net (line 40) | class M1Net(nn.Module): method __init__ (line 41) | def __init__(self,connection): method forward (line 47) | def forward(self, input): method reset (line 66) | def reset(self): class VNet (line 70) | class VNet(nn.Module): method __init__ (line 71) | def __init__(self,connection): method forward (line 77) | def forward(self, input): method reset (line 96) | def reset(self): class S1Net (line 100) | class S1Net(nn.Module): method __init__ (line 101) | def __init__(self,connection): method forward (line 107) | def forward(self, input, FR, C, Fired, W_LatInh): method reset (line 145) | def reset(self): class EBANet (line 149) | class EBANet(nn.Module): method __init__ (line 150) | def __init__(self,connection): method forward (line 156) | def forward(self, input, FR, C, Fired, W_LatInh): method reset (line 194) | def reset(self): class TPJNet (line 198) | class TPJNet(nn.Module): method __init__ (line 199) | def __init__(self,connection): method forward (line 205) | def forward(self, input, FR, C): method reset (line 235) | def reset(self): method UpdateWeight (line 239) | def UpdateWeight(self, i, W): class AINet (line 242) | class AINet(nn.Module): method __init__ (line 243) | def __init__(self,connection): method forward (line 249) | def forward(self, input, FR, C): method reset (line 279) | def reset(self): method UpdateWeight (line 283) | def UpdateWeight(self, i, W, WIn): function DeltaWeight (line 287) | def DeltaWeight(Pre, Pre_n, Post, Post_n): FILE: examples/Hardware_acceleration/firefly_v1_schedule_on_pynq.py class FireFlyV1ConvSchedule (line 9) | class FireFlyV1ConvSchedule: method __init__ (line 10) | def __init__( method gen_cmd (line 119) | def gen_cmd(self): method send_config (line 139) | def send_config(self): method begin_schedule_non_blocking (line 156) | def begin_schedule_non_blocking(self): method begin_schedule_blocking (line 161) | def begin_schedule_blocking(self): method clear_schedule (line 167) | def clear_schedule(self): method run_all (line 170) | def run_all(self): method read_status (line 199) | def read_status(self): function create_schedule (line 212) | def create_schedule(model_config_list: list, function schedule_run_all (line 320) | def schedule_run_all(schedule_list): function gen_cmd_array (line 325) | def gen_cmd_array(schedule_list): function init_firefly_c_lib (line 332) | def init_firefly_c_lib(path, schedule_list): function init_firefly_c_lib_with_time (line 347) | def init_firefly_c_lib_with_time(path, schedule_list): function firefly_v1_simulate (line 362) | def firefly_v1_simulate(model_config_list, x): function evaluate_simulate (line 380) | def evaluate_simulate(model_config_list, sample): FILE: examples/Hardware_acceleration/standalone_utils.py function get_im2col_indices (line 7) | def get_im2col_indices(x_shape, field_height, field_width, padding=1, st... function im2col_indices (line 27) | def im2col_indices(x, field_height, field_width, padding=1, stride=1): function max_pool_forward_reshape (line 37) | def max_pool_forward_reshape(x, pool_param): function max_pool_forward_fast (line 49) | def max_pool_forward_fast(x, pool_param): function max_pool_forward_im2col (line 63) | def max_pool_forward_im2col(x, pool_param): function conv_forward_fast (line 82) | def conv_forward_fast(x, w, b, pad=1, stride=1): function spike_map_pack_to_bytes_array (line 101) | def spike_map_pack_to_bytes_array(spike_map, parallel): function bytes_array_split_to_spike_map (line 107) | def bytes_array_split_to_spike_map(buf_in, time_step, parallel, H, W): function preprocess (line 113) | def preprocess(model_config_list, x, parallel): function integrate_and_fire (line 128) | def integrate_and_fire(y, threshold): function direct_coding (line 139) | def direct_coding(x, w, b, time_step, threshold): function conv_ifnode_forward (line 145) | def conv_ifnode_forward(x, w, b, threshold): function conv_ifnode_maxpool_forward (line 151) | def conv_ifnode_maxpool_forward(x, w, b, threshold): function linear_wta_forward (line 157) | def linear_wta_forward(x, w, b): function linear_ifnode_forward (line 169) | def linear_ifnode_forward(x, w, b, threshold): function pad_conv_weight_round_to_parallel (line 180) | def pad_conv_weight_round_to_parallel(parallel, weight, pad_output_chann... function pad_linear_weight_round_to_parallel (line 191) | def pad_linear_weight_round_to_parallel(parallel, weight): function pad_linear_weight_round_to_factor (line 198) | def pad_linear_weight_round_to_factor(weight, factor): function pad_bias_round_to_parallel (line 206) | def pad_bias_round_to_parallel(parallel, bias, pad_value=0): function np_quantize_per_tensor (line 213) | def np_quantize_per_tensor(x, scale, zero_point): function np_quantize_prepare (line 221) | def np_quantize_prepare(x, scale, zero_point): function conv_weight_channel_tiling (line 226) | def conv_weight_channel_tiling(parallel, weight): function linear_weight_channel_tiling (line 230) | def linear_weight_channel_tiling(parallel, weight): function conv_to_linear_weight_tiling (line 234) | def conv_to_linear_weight_tiling(parallel, h, w, weight): function init_input_buffer (line 238) | def init_input_buffer(input_spikes, function get_from_output_buffer (line 254) | def get_from_output_buffer(output_buffer, function get_output_index (line 271) | def get_output_index(buffer, parallel): function save_model_config_list (line 281) | def save_model_config_list(model_config_list, path): function load_model_config_list (line 286) | def load_model_config_list(path): FILE: examples/Knowledge_Representation_and_Reasoning/CKRGSNN/main.py class CKRNet (line 19) | class CKRNet(BrainArea): method __init__ (line 24) | def __init__(self, w1, w2): method forward (line 36) | def forward(self, x): method reset (line 44) | def reset(self): function S_bound (line 48) | def S_bound(S): FILE: examples/Knowledge_Representation_and_Reasoning/CRSNN/main.py class CRNet (line 17) | class CRNet(BrainArea): method __init__ (line 29) | def __init__(self, w1, w2): method forward (line 41) | def forward(self, x): method reset (line 52) | def reset(self): function S_bound (line 56) | def S_bound(S): FILE: examples/Knowledge_Representation_and_Reasoning/SPSNN/main.py class SPNet (line 20) | class SPNet(BrainArea): method __init__ (line 33) | def __init__(self, w1, w2 ): method forward (line 45) | def forward(self, x): method reset (line 57) | def reset(self): function S_bound (line 62) | def S_bound(S): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Areas/apac.py class APAC (line 10) | class APAC(): method __init__ (line 16) | def __init__(self): method encodingNote (line 23) | def encodingNote(self,NoteID): method encodingMIDINote (line 31) | def encodingMIDINote(self,p): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Areas/cortex.py class Cortex (line 16) | class Cortex(): method __init__ (line 21) | def __init__(self, neutype, dt): method addSubGoalToPFC (line 27) | def addSubGoalToPFC(self, goalname): method addComposerToPFC (line 33) | def addComposerToPFC(self, composername): method addGenreToPFC (line 39) | def addGenreToPFC(self, genrename): method musicSequenceMemroyInit (line 45) | def musicSequenceMemroyInit(self): method rememberANote (line 48) | def rememberANote(self, goalname, noteName, order): method connectKeyAndNotesUsingKSModel (line 66) | def connectKeyAndNotesUsingKSModel(self,keys, Notes): method connectKeyAndNotes (line 90) | def connectKeyAndNotes(self,keys, Notes): method connectKeyAndNotesUsingKSModel (line 107) | def connectKeyAndNotesUsingKSModel(self,keys, Notes): method rememberANoteWithKnowledge (line 130) | def rememberANoteWithKnowledge(self,goalname, composername, genrename,... method rememberANoteandTempo (line 161) | def rememberANoteandTempo(self, goalname, composername, genrename, tra... method actionSequenceMemoryInit (line 223) | def actionSequenceMemoryInit(self): method recallMusicPFC (line 226) | def recallMusicPFC(self, goalName): method recallMusicByEpisode (line 234) | def recallMusicByEpisode(self, episodeNotes): # using time window sea... method generateEx_Nihilo (line 248) | def generateEx_Nihilo(self, firstNote, durations, length): method generateEx_Nihilo2 (line 310) | def generateEx_Nihilo2(self, firstNote, durations, length): method generateEx_NihiloAccordingToGenre (line 358) | def generateEx_NihiloAccordingToGenre(self, genreName, firstNote, dura... method generateEx_NihiloAccordingToComposer (line 407) | def generateEx_NihiloAccordingToComposer(self, composerName, firstNote... method generateMelodyWithKey (line 468) | def generateMelodyWithKey(self, key, firstNotes, durations, length): method recallActionIPS (line 528) | def recallActionIPS(self, goalName): method generate2TrackMusic (line 533) | def generate2TrackMusic(self, firstNotes, durations, lengths): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Areas/pac.py class PAC (line 16) | class PAC(BrainArea,SequenceMemory): method __init__ (line 21) | def __init__(self, neutype): method forward (line 27) | def forward(self, x): method createActionSequenceMem (line 30) | def createActionSequenceMem(self, layernum, neutype): method doRemembering_note_only (line 40) | def doRemembering_note_only(self, note, order, dt, t): method doRemembering (line 50) | def doRemembering(self, trackIndex, noteIndex, order, dt, t, tinterval... method doConnectToTitle (line 72) | def doConnectToTitle(self, title, track, order): method doConnectToComposer (line 76) | def doConnectToComposer(self, composer, track, order): method doConnectToGenre (line 80) | def doConnectToGenre(self, genre, track, order): method generateEx_Nihilo (line 84) | def generateEx_Nihilo(self, firstNote, durations, order, dt, t): method generateSimgleTrackNotes (line 109) | def generateSimgleTrackNotes(self, trackIndex, firstNote, durations, o... class Music_Sequence_Mem (line 136) | class Music_Sequence_Mem(SequenceMemory): method __init__ (line 141) | def __init__(self, neutype): method createActionSequenceMem (line 147) | def createActionSequenceMem(self, layernum, neutype): method doRemembering_note_only (line 157) | def doRemembering_note_only(self, note, order, dt, t): method doRemembering (line 167) | def doRemembering(self, trackIndex, noteIndex, order, dt, t, tinterval... method recallByEpisode (line 187) | def recallByEpisode(self, episodeNotes, goals): method recallByEpisode2 (line 277) | def recallByEpisode2(self, episodeNotes, goals): method doConnectToTitle (line 432) | def doConnectToTitle(self, title, track, order): method doConnectToComposer (line 436) | def doConnectToComposer(self, composer, track, order): method doConnectToGenre (line 440) | def doConnectToGenre(self, genre, track, order): method doConnectToEmotion (line 444) | def doConnectToEmotion(self, emo, track, order): method doConnectToKey (line 448) | def doConnectToKey(self, key, track, order, noteIndex): method doConnectToMode (line 483) | def doConnectToMode(self, mode, keyName, track, order, noteIndex): # ... method generateEx_Nihilo (line 520) | def generateEx_Nihilo(self, firstNote, durations, order, dt, t): method generateMelodyWithTone (line 545) | def generateMelodyWithTone(self, firstNote, duration, tone, order, dt,... method generateSimgleTrackNotes (line 576) | def generateSimgleTrackNotes(self, trackIndex, firstNote, durations, o... FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Areas/pfc.py class PFC (line 12) | class PFC(PFC): method __init__ (line 17) | def __init__(self, neutype): method addNewKey (line 31) | def addNewKey(self): method addNewSubGoal (line 37) | def addNewSubGoal(self, goalname): method addNewComposer (line 41) | def addNewComposer(self, composername): method addNewGenre (line 45) | def addNewGenre(self, genrename): method addNewMode (line 49) | def addNewMode(self): method addNewKey (line 71) | def addNewKey(self): method addNewChord (line 77) | def addNewChord(self): method setTestStates (line 105) | def setTestStates(self): method doRecalling (line 114) | def doRecalling(self, goalname, asm): method doRecalling2 (line 139) | def doRecalling2(self, goalname, asm): method doRecalling3 (line 180) | def doRecalling3(self,goalname,asm): method doRemebering (line 236) | def doRemebering(self, goalname, dt, t): method doRememberingComposer (line 243) | def doRememberingComposer(self, composername, dt, t): method doRememberingGenre (line 249) | def doRememberingGenre(self, genrename, dt, t): method doRememberingKey (line 255) | def doRememberingKey(self, key, dt, t): method doRememberingMode (line 261) | def doRememberingMode(self,mode, dt,t): method innerLearning (line 267) | def innerLearning(self, goalname, composer, genre): method inhibitGenres (line 320) | def inhibitGenres(self,dt,t): method inhibiteGoals (line 327) | def inhibiteGoals(self, dt, t): method inhibitComposers (line 334) | def inhibitComposers(self, dt, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/PAC.py class PAC (line 10) | class PAC(BrainArea): method __int__ (line 12) | def __int__(self,w,mask): method forward (line 19) | def forward(self, x): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/cluster.py class Cluster (line 6) | class Cluster(): method __init__ (line 11) | def __init__(self, neutype='LIF', neunum=10): method createClusterNetwork (line 22) | def createClusterNetwork(self): method setInhibitoryNeurons (line 43) | def setInhibitoryNeurons(self, ratio_inhneuron): method setPropertiesofNeurons (line 47) | def setPropertiesofNeurons(self, groupID, layerType, layerID): method setTestStates (line 53) | def setTestStates(self): method createFullConnections (line 57) | def createFullConnections(self): # all in all connections method createInhibitoryConnections (line 67) | def createInhibitoryConnections(self): # all in all inhibitory connec... method writeSelfInfoToJson (line 79) | def writeSelfInfoToJson(self): method writeSpikeInfoToJson (line 91) | def writeSpikeInfoToJson(self): class ModeCluster (line 102) | class ModeCluster(Cluster): method __init__ (line 103) | def __init__(self, neutype, neunum): method createClusterNetwork (line 106) | def createClusterNetwork(self, areaName): class KeyCluster (line 122) | class KeyCluster(Cluster): method __init__ (line 123) | def __init__(self, neutype, neunum): method createClusterNetwork (line 129) | def createClusterNetwork(self,tone,areaName): class ChordCluster (line 166) | class ChordCluster(Cluster): method __init__ (line 167) | def __init__(self, neutype,neunum): method createClusterNetwork (line 170) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/composercluster.py class ComposerCluster (line 5) | class ComposerCluster(Cluster): method __init__ (line 10) | def __init__(self, neutype, neunum): method createClusterNetwork (line 16) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/composerlayer.py class ComposerLayer (line 5) | class ComposerLayer(Layer): method __init__ (line 10) | def __init__(self, neutype='LIF'): method setTestStates (line 14) | def setTestStates(self): method addNewGroups (line 18) | def addNewGroups(self, groupID, layerID, neunum, composername): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/composerlifneuron.py class ComposerLIFNeuron (line 4) | class ComposerLIFNeuron(LIFNeuron): method __init__ (line 9) | def __init__(self, tau_ref=0, vthresh=5, Rm=2, Cm=0.2): method update (line 15) | def update(self, dt, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/genrecluster.py class GenreCluster (line 4) | class GenreCluster(Cluster): method __init__ (line 9) | def __init__(self, neutype, neunum): method createClusterNetwork (line 15) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/genrelayer.py class GenreLayer (line 3) | class GenreLayer(Layer): method __init__ (line 8) | def __init__(self, neutype='LIF'): method setTestStates (line 12) | def setTestStates(self): method addNewGroups (line 16) | def addNewGroups(self, groupID, layerID, neunum, genrename): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/genrelifneuron.py class GenreLIFNeuron (line 3) | class GenreLIFNeuron(LIFNeuron): method __init__ (line 8) | def __init__(self, tau_ref=0, vthresh=5, Rm=2, Cm=0.2): method update (line 14) | def update(self, dt, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/izhikevichneuron.py class IzhikevichNeuron (line 12) | class IzhikevichNeuron(IzhNodeMU): method __init__ (line 18) | def __init__(self, a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30, dt=0.1): method update_old (line 50) | def update_old(self,dt,t): method update (line 65) | def update(self,dt,t,state): method update_learn (line 70) | def update_learn(self,dt,t): method update_test (line 82) | def update_test(self,dt,t): method update_normal (line 91) | def update_normal(self,dt,t): method updateSynapses (line 102) | def updateSynapses(self,t): method updateCurrentOfLowerAndUpperLayer (line 106) | def updateCurrentOfLowerAndUpperLayer(self,t): method setTestStates (line 130) | def setTestStates(self): method writeBasicInfoToJson (line 140) | def writeBasicInfoToJson(self): method writeSpikeTimeToJson (line 162) | def writeSpikeTimeToJson(self): class NoteIzhikevichNeuron (line 172) | class NoteIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 173) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30): method setPreference (line 175) | def setPreference(self): method computeFilterCurrent (line 177) | def computeFilterCurrent(self): method updateCurrentOfLowerAndUpperLayer (line 181) | def updateCurrentOfLowerAndUpperLayer(self, t): class TempoIzhikevichNeuron (line 205) | class TempoIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 206) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30): method setPreference (line 208) | def setPreference(self): method computeFilterCurrent (line 211) | def computeFilterCurrent(self): method updateCurrentOfLowerAndUpperLayer (line 215) | def updateCurrentOfLowerAndUpperLayer(self, t): class TitleIzhikevichNeuron (line 243) | class TitleIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 244) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh=30): class ComposerIzhikevichNeuron (line 247) | class ComposerIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 248) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh=30): class GenreIzhikevichNeuron (line 251) | class GenreIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 252) | def __init__(self, a = 0.1,b = 0.2,c = -65,d = 8, vthresh=30): class AmyIzhikevichNeuron (line 255) | class AmyIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 256) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh=30): class DirectionIzhikevichNeuron (line 259) | class DirectionIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 260) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh=30): method setPreference (line 263) | def setPreference(self): method computeFilterCurrent (line 267) | def computeFilterCurrent(self, input): method updateCurrentOfLowerAndUpperLayer (line 271) | def updateCurrentOfLowerAndUpperLayer(self, t): class GridIzhikevichCell (line 296) | class GridIzhikevichCell(IzhikevichNeuron): method __init__ (line 297) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30): class KeyIzhikevichNeuron (line 299) | class KeyIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 300) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30): class ModeIzhikevichNeuron (line 303) | class ModeIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 304) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8,vthresh = 30): class ChordIzhikevichNeuron (line 307) | class ChordIzhikevichNeuron(IzhikevichNeuron): method __init__ (line 308) | def __init__(self,a = 0.1,b = 0.2,c = -65,d = 8, vthresh = 30): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/layer.py class Layer (line 4) | class Layer(): method __init__ (line 10) | def __init__(self, neutype): method resetProperties (line 18) | def resetProperties(self): method addNewGroups (line 21) | def addNewGroups(self, layerID, neunum): class ModeLayer (line 24) | class ModeLayer(Layer): method __init__ (line 25) | def __init__(self, neutype = 'LIF'): method setTestStates (line 29) | def setTestStates(self): method addNewGroups (line 33) | def addNewGroups(self, groupID, layerID, neunum, modeName): class KeyLayer (line 41) | class KeyLayer(Layer): method __init__ (line 42) | def __init__(self, neutype='LIF'): method setTestStates (line 46) | def setTestStates(self): method addNewGroups (line 50) | def addNewGroups(self, groupID, layerID, neunum, key): class ChordLayer (line 58) | class ChordLayer(Layer): method __init__ (line 59) | def __init__(self, neutype = 'LIF'): method setTestStates (line 62) | def setTestStates(self): method addNewGroups (line 66) | def addNewGroups(self,groupID, layerID, neunum): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/lifneuron.py class LIFNeuron (line 5) | class LIFNeuron(node.LIFNode): method __init__ (line 7) | def __init__(self, tau_ref = 0, vthresh = 5, Rm = 2, Cm = 0.2,dt = 0.1... method update (line 36) | def update(self, dt, t, state): # state = 'learn' or state = 'test' method update_learn (line 50) | def update_learn(self, dt, t): method update_test (line 70) | def update_test(self, dt, t): method update_normal (line 81) | def update_normal(self, dt, t): method updateSynapses (line 93) | def updateSynapses(self, t): method setTestStates (line 97) | def setTestStates(self): method computeFilterCurrent (line 108) | def computeFilterCurrent(self): method setPreference (line 111) | def setPreference(self): # set preference of a neuron or called selec... method writeBasicInfoToJson (line 115) | def writeBasicInfoToJson(self, areaName): method writeSpikeTimeToJson (line 139) | def writeSpikeTimeToJson(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/note.py class Note (line 7) | class Note(): method __init__ (line 12) | def __init__(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/notecluster.py class NoteCluster (line 5) | class NoteCluster(Cluster): method __init__ (line 10) | def __init__(self, neutype, neunum): method createClusterNetwork (line 16) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/notelifneuron.py class NoteLIFNeuron (line 4) | class NoteLIFNeuron(LIFNeuron): method __init__ (line 9) | def __init__(self, tau_ref=0.5, vthresh=5, Rm=2, Cm=0.2): method setPreference (line 15) | def setPreference(self): method computeFilterCurrent (line 18) | def computeFilterCurrent(self): method updateCurrentOfLowerAndUpperLayer (line 22) | def updateCurrentOfLowerAndUpperLayer(self, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/notesequencelayer.py class NoteSequenceLayer (line 6) | class NoteSequenceLayer(SequenceLayer): method __init__ (line 11) | def __init__(self, neutype): method addNewGroups (line 17) | def addNewGroups(self, GroupID, layerID, neunum): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/pitch.py class Pitch (line 7) | class Pitch(): method __init__ (line 13) | def __init__(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/sequencelayer.py class SequenceLayer (line 6) | class SequenceLayer(Layer): method __init__ (line 11) | def __init__(self, neutype='LIF'): method addNewGroups (line 19) | def addNewGroups(self, GroupID, layerID, neunum): method setTestStates (line 39) | def setTestStates(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/sequencememory.py class SequenceMemory (line 6) | class SequenceMemory(): method __init__ (line 11) | def __init__(self, neutype): method createActionSequenceMem (line 18) | def createActionSequenceMem(self, layernum, neutype, neunumpergroup): method doRemembering (line 21) | def doRemembering(self): method doConnecting (line 24) | def doConnecting(self, goal, sl, order): method setTestStates (line 192) | def setTestStates(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/synapse.py class Synapse (line 3) | class Synapse(): method __init__ (line 8) | def __init__(self, pre, post): method computeWeight (line 20) | def computeWeight(self, t): method computeShortTermFacilitation (line 56) | def computeShortTermFacilitation(self, t): method computeShortTermFacilitation2 (line 79) | def computeShortTermFacilitation2(self, t): method computeShortTermReduction (line 96) | def computeShortTermReduction(self, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/tempocluster.py class TempoCluster (line 5) | class TempoCluster(Cluster): method __init__ (line 10) | def __init__(self, neutype, neunum): method createClusterNetwork (line 16) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/tempolifneuron.py class TempoLIFNeuron (line 5) | class TempoLIFNeuron(LIFNeuron): method __init__ (line 10) | def __init__(self, tau_ref=0.5, vthresh=5, Rm=2, Cm=0.2): method setPreference (line 16) | def setPreference(self): method computeFilterCurrent (line 20) | def computeFilterCurrent(self): method updateCurrentOfLowerAndUpperLayer (line 24) | def updateCurrentOfLowerAndUpperLayer(self, t): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/temposequencelayer.py class TempoSequenceLayer (line 6) | class TempoSequenceLayer(SequenceLayer): method __init__ (line 11) | def __init__(self, neutype): method addNewGroups (line 17) | def addNewGroups(self, GroupID, layerID, neunum): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/titlecluster.py class TitleCluster (line 5) | class TitleCluster(Cluster): method __init__ (line 10) | def __init__(self, neutype, neunum): method createClusterNetwork (line 17) | def createClusterNetwork(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/titlelayer.py class TitleLayer (line 7) | class TitleLayer(Layer): method __init__ (line 12) | def __init__(self, neutype='LIF'): method setTestStates (line 19) | def setTestStates(self): method addNewGroups (line 23) | def addNewGroups(self, groupID, layerID, neunum, goalname): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/Modal/titlelifneuron.py class TitleLIFNeuron (line 5) | class TitleLIFNeuron(LIFNeuron): method __init__ (line 10) | def __init__(self, tau_ref=0, vthresh=5, Rm=2, Cm=0.2): method updateCurrentOfLowerAndUpperLayer (line 16) | def updateCurrentOfLowerAndUpperLayer(self, t): method update (line 30) | def update(self, dt, t): method computeFiringRate (line 41) | def computeFiringRate(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/api/music_engine_api.py class EngineAPI (line 11) | class EngineAPI(): method __init__ (line 16) | def __init__(self): method cortexInit (line 23) | def cortexInit(self): method rememberMusic (line 29) | def rememberMusic(self, muiscName, composerName="None"): method learnFourPartMusic (line 58) | def learnFourPartMusic(self,xmldata, musicName, composerName="None"): method rememberPartNotes (line 73) | def rememberPartNotes(self,musicName, composerName, genreName, emo, ke... method rememberMIDIMusic (line 93) | def rememberMIDIMusic(self, musicName, composerName, noteLength, fileN... method rememberTrackNotes (line 113) | def rememberTrackNotes(self, musicName, composerName, genreName, track... method rememberNotes (line 196) | def rememberNotes(self, MusicName, notes, intervals, tempo=True): method rememberANote (line 213) | def rememberANote(self, MusicName, ComposerName, genreName, TrackIndex... method memorizing (line 223) | def memorizing(self,MusicName, ComposerName, noteLength, fileName): method recallMusic (line 234) | def recallMusic(self, musicName): method generateEx_Nihilo (line 255) | def generateEx_Nihilo(self, firstNote, durations, length,gen_fName): method generateEx_NihiloAccordingToGenre (line 268) | def generateEx_NihiloAccordingToGenre(self, genreName, firstNote, dura... method generateEx_NihiloAccordingToComposer (line 282) | def generateEx_NihiloAccordingToComposer(self, composerName, firstNote... method generate2TrackMusic (line 296) | def generate2TrackMusic(self, firstNotes, durations, lengths): method generateMelodyWithKey (line 300) | def generateMelodyWithKey(self,tone, firstNotes,durations = None,lengt... method writeMidiFile (line 306) | def writeMidiFile(self,fileName, mudic): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/conf/conf.py class Conf (line 4) | class Conf(): method __init__ (line 9) | def __init__(self, neutype="LIF", task="MusicLearning", dt=0.1): method readNoteFiles (line 29) | def readNoteFiles(self): method readGenreFils (line 42) | def readGenreFils(self): method readEmotionFiles (line 56) | def readEmotionFiles(self): method readKeysFile (line 69) | def readKeysFile(self): method readKeys2IndexFile (line 86) | def readKeys2IndexFile(self): method readChordsFile (line 97) | def readChordsFile(self): method readModesFile (line 112) | def readModesFile(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/generateData.py class joint (line 9) | class joint(): method __init__ (line 10) | def __init__(self): method self2dic (line 14) | def self2dic(self): class data (line 19) | class data(): method __init__ (line 21) | def __init__(self): method self2dic (line 26) | def self2dic(self): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/msg.py class MyListener (line 9) | class MyListener(object): method on_error (line 10) | def on_error(self, headers, message): method on_message (line 12) | def on_message(self, headers, message): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/msgq.py function createMSQ (line 10) | def createMSQ(): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/readjson.py function readjsonFile (line 11) | def readjsonFile(filename): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/testopengl.py function drawFunc (line 10) | def drawFunc(): FILE: examples/Knowledge_Representation_and_Reasoning/musicMemory/tools/xmlParser.py function readXmlAsCsv (line 10) | def readXmlAsCsv(xmlPath='xml/'): FILE: examples/MotorControl/experimental/brain_area.py class MoColumnPOP (line 7) | class MoColumnPOP(nn.Module): method __init__ (line 8) | def __init__(self, method reset (line 29) | def reset(self): method _emb_decode (line 34) | def _emb_decode(self, x): method forward (line 42) | def forward(self, inputs): class MotorCortex (line 48) | class MotorCortex(nn.Module): method __init__ (line 49) | def __init__(self, method reset (line 84) | def reset(self): method _compute_motor_out (line 90) | def _compute_motor_out(self, inputs): method forward (line 99) | def forward(self, inputs): class Celebellum (line 110) | class Celebellum(nn.Module): method __init__ (line 111) | def __init__(self, method reset (line 136) | def reset(self): method forward (line 140) | def forward(self, x): FILE: examples/MotorControl/experimental/main.py function creat_key_finger_emb (line 72) | def creat_key_finger_emb(): function mse_loss (line 81) | def mse_loss(pred, target): function main (line 85) | def main(): FILE: examples/MotorControl/experimental/model.py class Motion (line 7) | class Motion(nn.Module): method __init__ (line 8) | def __init__(self, in_dims: int, out_dims: int=17, time_window: int=8,... method forward (line 16) | def forward(self, x): method learn (line 22) | def learn(self): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/cortex.py class Cortex (line 11) | class Cortex(): method __init__ (line 17) | def __init__(self,neuronnumscale): method setNeuronToIndex (line 31) | def setNeuronToIndex(self,node): method setLayers (line 35) | def setLayers(self): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/cortex_thalamus.py class Cortex_Thalamus (line 17) | class Cortex_Thalamus(): method __init__ (line 31) | def __init__(self, neuronnumscale): method setSynapseNum (line 44) | def setSynapseNum(self): method setLayer (line 51) | def setLayer(self): method setNeuronsDendritesAndSynapes (line 62) | def setNeuronsDendritesAndSynapes(self): method setSynapsesToDendrites (line 192) | def setSynapsesToDendrites(self): method setCortexProperties (line 227) | def setCortexProperties(self): method setThalamusProperties (line 229) | def setThalamusProperties(self): method CreateCortexNetwork (line 232) | def CreateCortexNetwork(self): method getTotalNeuronNumber (line 240) | def getTotalNeuronNumber(self): method getTotalSynapseNumber (line 242) | def getTotalSynapseNumber(self): method getCortexNeuronNumber (line 244) | def getCortexNeuronNumber(self): method getThalamoNeuronNumber (line 246) | def getThalamoNeuronNumber(self): method getSpecifiedNeuronNumber (line 248) | def getSpecifiedNeuronNumber(self,name): method getNeuronTypesNumber (line 259) | def getNeuronTypesNumber(self): method getNeuronTypes (line 261) | def getNeuronTypes(self): method getCorticalSynapseNumber (line 263) | def getCorticalSynapseNumber(self): method getThalamoSynapseNumber (line 265) | def getThalamoSynapseNumber(self): method getPreAndPostNeuronsOfSynapse (line 267) | def getPreAndPostNeuronsOfSynapse(self,index): method getCortexLayerNeuronNumber (line 272) | def getCortexLayerNeuronNumber(self,layername): method getCortexLayerSynapseNumber (line 275) | def getCortexLayerSynapseNumber(self,layername): method getCortexLayerNeuronTypes (line 278) | def getCortexLayerNeuronTypes(self,layername): method getCortexLayerPreAndPostNeuronsOfSynapse (line 284) | def getCortexLayerPreAndPostNeuronsOfSynapse(self,layername,index): method getNeuronAllPreNeuronsTypes (line 288) | def getNeuronAllPreNeuronsTypes(self,index): method outputNeuronInfo (line 292) | def outputNeuronInfo(self): method outputConnectionMatrix (line 301) | def outputConnectionMatrix(self): method outputsynapspercent (line 321) | def outputsynapspercent(self,namelist): method run (line 334) | def run(self): method outputSpikeThreashold (line 344) | def outputSpikeThreashold(self): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/dendrite.py class Dendrite (line 11) | class Dendrite(): method __init__ (line 16) | def __init__(self): method setSynapse (line 24) | def setSynapse(self,syn): method getSynapseInfo (line 35) | def getSynapseInfo(self,f,nodename,denpos): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/layer.py class Layer (line 10) | class Layer(): method __init__ (line 21) | def __init__(self): method getLayerNeuronNumber (line 29) | def getLayerNeuronNumber(self): method getLayerSynapseNumber (line 31) | def getLayerSynapseNumber(self): method getLayerNeuronTypes (line 33) | def getLayerNeuronTypes(self): method stimulateNeuronInLayer4_BFS (line 36) | def stimulateNeuronInLayer4_BFS(self, T, neulist): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/synapse.py class Synapse (line 7) | class Synapse(): method __init__ (line 17) | def __init__(self, pre,post,locationlayer): method getInfo (line 31) | def getInfo(self,f,nodename,denpos,denlayer): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/model/thalamus.py class Thalamus (line 7) | class Thalamus(): method __init__ (line 13) | def __init__(self): method setNeuronToIndex (line 23) | def setNeuronToIndex(self,node): method setThalamusProperties (line 27) | def setThalamusProperties(self): FILE: examples/Multiscale_Brain_Structure_Simulation/CorticothalamicColumn/tools/exdata.py class EXDATA (line 4) | class EXDATA(): method __int__ (line 5) | def __int__(self): method getCortexData (line 8) | def getCortexData(self): method getCortexData2 (line 28) | def getCortexData2(self): method getLayerData (line 34) | def getLayerData(self): method getNeuronData (line 54) | def getNeuronData(self): method getSynapseData (line 72) | def getSynapseData(self, postneuron): FILE: examples/Multiscale_Brain_Structure_Simulation/Corticothalamic_Brain_Model/Bioinformatics_propofol_circle.py class brain_model_91 (line 13) | class brain_model_91(): method __init__ (line 15) | def __init__(self, W, D): method simulation (line 155) | def simulation(self): FILE: examples/Multiscale_Brain_Structure_Simulation/Corticothalamic_Brain_Model/spectrogram.py function region_sxx (line 41) | def region_sxx(region): function global_sxx (line 60) | def global_sxx(): function compare_sxx (line 76) | def compare_sxx(): FILE: examples/Multiscale_Brain_Structure_Simulation/HumanBrain/human_brain.py class Syn (line 15) | class Syn(nn.Module): method __init__ (line 16) | def __init__(self, syn, weight, neuron_num, tao_d, tao_r, dt, device): method forward (line 33) | def forward(self, neuron): class brain (line 42) | class brain(nn.Module): method __init__ (line 43) | def __init__(self, syn, weight, neuron_model, p_neuron, dt, device): method forward (line 52) | def forward(self, inputs): function brain_region (line 57) | def brain_region(neuron_num): function neuron_type (line 67) | def neuron_type(neuron_num, ratio, regions): function syn_within_region (line 72) | def syn_within_region(syn_num, region): function syn_cross_region (line 84) | def syn_cross_region(weight_matrix, region): FILE: examples/Multiscale_Brain_Structure_Simulation/HumanBrain/human_multi.py class MultiCompartmentaEIF (line 19) | class MultiCompartmentaEIF(BaseNode): method __init__ (line 30) | def __init__(self, method integral (line 62) | def integral(self,apical_inputs): method calc_spike (line 71) | def calc_spike(self): method forward (line 75) | def forward(self, inputs): class aEIF (line 85) | class aEIF(BaseNode): method __init__ (line 93) | def __init__(self, p, dt, device, *args, **kwargs): method integral (line 133) | def integral(self, inputs): method calc_spike (line 143) | def calc_spike(self): method forward (line 149) | def forward(self, inputs): class HHNode (line 157) | class HHNode(BaseNode): method __init__ (line 170) | def __init__(self, p, dt, device, act_fun=AtanGrad, *args, **kwargs): method integral (line 203) | def integral(self, inputs): method calc_spike (line 237) | def calc_spike(self): method forward (line 240) | def forward(self, inputs): method requires_activation (line 245) | def requires_activation(self): class Syn (line 248) | class Syn(nn.Module): method __init__ (line 249) | def __init__(self, syn, weight, neuron_num, tao_d, tao_r, dt, device): method forward (line 266) | def forward(self, neuron): class brain (line 275) | class brain(nn.Module): method __init__ (line 276) | def __init__(self, syn, weight, neuron_model, p_neuron, dt, device): method forward (line 287) | def forward(self, inputs): function brain_region (line 292) | def brain_region(neuron_num): function neuron_type (line 302) | def neuron_type(neuron_num, ratio, regions): function syn_within_region (line 307) | def syn_within_region(syn_num, region): function syn_cross_region (line 319) | def syn_cross_region(weight_matrix, region): function neuron_delete (line 484) | def neuron_delete(model, rate): function syn_delete (line 491) | def syn_delete(model, rate): function syn_strength (line 502) | def syn_strength(model, rate): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/NA.py function histogram_entropy (line 16) | def histogram_entropy(data, bins='auto'): function hub_degree (line 38) | def hub_degree(df, W_new): function visual (line 57) | def visual(df, W_new): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/main_246.py class brain_model (line 14) | class brain_model(): method __init__ (line 16) | def __init__(self, W): method simulation (line 173) | def simulation(self, per): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/main_84.py class brain_model (line 14) | class brain_model(): method __init__ (line 16) | def __init__(self, W): method simulation (line 173) | def simulation(self, per): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/pci.py function generate_rm (line 15) | def generate_rm(Iraster): function lempel_ziv_complexity (line 70) | def lempel_ziv_complexity(data): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/pci_246.py function generate_rm (line 15) | def generate_rm(Iraster): function lempel_ziv_complexity (line 70) | def lempel_ziv_complexity(data): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_Brain_Model/spectrogram.py function region_sxx (line 42) | def region_sxx(region): function global_sxx (line 58) | def global_sxx(): function compare_sxx (line 74) | def compare_sxx(): function fit (line 99) | def fit(xx, yy): FILE: examples/Multiscale_Brain_Structure_Simulation/Human_PFC_Model/Six_Layer_PFC.py class six_layer_pfc (line 12) | class six_layer_pfc(): method __init__ (line 18) | def __init__(self): method picture (line 30) | def picture(self,path=None): method mex_function (line 48) | def mex_function(self, path=None): class SynType (line 623) | class SynType: method __init__ (line 624) | def __init__(self): class Neuron (line 641) | class Neuron: method __init__ (line 653) | def __init__(self): class InpNeuron (line 685) | class InpNeuron: method __init__ (line 692) | def __init__(self): class Synapse (line 703) | class Synapse: method __init__ (line 707) | def __init__(self): class SynDepr (line 715) | class SynDepr: method __init__ (line 723) | def __init__(self): class SynList (line 733) | class SynList: method __init__ (line 737) | def __init__(self): FILE: examples/Multiscale_Brain_Structure_Simulation/MacaqueBrain/macaque_brain.py class Syn (line 14) | class Syn(nn.Module): method __init__ (line 15) | def __init__(self, syn, weight, neuron_num, tao_d, tao_r, dt, device): method forward (line 32) | def forward(self, neuron): class brain (line 41) | class brain(nn.Module): method __init__ (line 42) | def __init__(self, syn, weight, neuron_model, p_neuron, dt, device): method forward (line 51) | def forward(self, inputs): function brain_region (line 56) | def brain_region(neuron_num): function neuron_type (line 66) | def neuron_type(neuron_num, ratio, regions): function syn_within_region (line 71) | def syn_within_region(syn_num, region): function syn_cross_region (line 83) | def syn_cross_region(weight_matrix, region): FILE: examples/Multiscale_Brain_Structure_Simulation/MouseBrain/mouse_brain.py class Syn (line 14) | class Syn(nn.Module): method __init__ (line 15) | def __init__(self, syn, weight, neuron_num, tao_d, tao_r, dt, device): method forward (line 32) | def forward(self, neuron): class brain (line 41) | class brain(nn.Module): method __init__ (line 42) | def __init__(self, syn, weight, neuron_model, p_neuron, dt, device): method forward (line 51) | def forward(self, inputs): function brain_region (line 56) | def brain_region(neuron_num): function neuron_type (line 66) | def neuron_type(neuron_num, ratio, regions): function syn_within_region (line 71) | def syn_within_region(syn_num, region): function syn_cross_region (line 83) | def syn_cross_region(weight_matrix, region): FILE: examples/Perception_and_Learning/Conversion/burst_conversion/CIFAR10_VGG16.py class VGG16 (line 17) | class VGG16(nn.Module): method __init__ (line 18) | def __init__(self, relu_max=1): # 1 3e38 method forward (line 43) | def forward(self, input): function get_cifar10_loader (line 50) | def get_cifar10_loader(batch_size, train_batch=None, num_workers=4, conv... function train (line 74) | def train(net, train_iter, test_iter, optimizer, scheduler, device, num_... function evaluate_accuracy (line 117) | def evaluate_accuracy(data_iter, net, device=None, only_onebatch=False): FILE: examples/Perception_and_Learning/Conversion/burst_conversion/converted_CIFAR10.py function evaluate_snn (line 44) | def evaluate_snn(test_iter, snn, device=None, duration=50): FILE: examples/Perception_and_Learning/Conversion/msat_conversion/CIFAR10_VGG16.py class VGG16 (line 17) | class VGG16(nn.Module): method __init__ (line 18) | def __init__(self, relu_max=1): # 1 3e38 method forward (line 43) | def forward(self, input): function get_cifar10_loader (line 50) | def get_cifar10_loader(batch_size, train_batch=None, num_workers=4, conv... function train (line 74) | def train(net, train_iter, test_iter, optimizer, scheduler, device, num_... function evaluate_accuracy (line 117) | def evaluate_accuracy(data_iter, net, device=None, only_onebatch=False): FILE: examples/Perception_and_Learning/Conversion/msat_conversion/converted_CIFAR10.py function evaluate_snn (line 46) | def evaluate_snn(test_iter, snn, device=None, duration=50): FILE: examples/Perception_and_Learning/Conversion/msat_conversion/convertor.py class FolderPath (line 13) | class FolderPath: class HookScale (line 16) | class HookScale(nn.Module): method __init__ (line 23) | def __init__(self, method forward (line 38) | def forward(self, x): class Hookoutput (line 52) | class Hookoutput(nn.Module): method __init__ (line 57) | def __init__(self, module): method forward (line 62) | def forward(self, x): class Scale (line 68) | class Scale(nn.Module): method __init__ (line 73) | def __init__(self, scale: float = 1.0): method forward (line 77) | def forward(self, x): function reset (line 84) | def reset(self): class Convertor (line 97) | class Convertor(nn.Module): method __init__ (line 118) | def __init__(self, method forward (line 146) | def forward(self, model): method register_hook (line 157) | def register_hook(model, p=0.99, channelnorm=False, gamma=0.999): method get_percentile (line 172) | def get_percentile(model, dataloader, device, batch_num=1): method replace_for_spike (line 184) | def replace_for_spike(model, lipool=True, soft_mode=True, gamma=1, spi... class SNode (line 208) | class SNode(nn.Module): method __init__ (line 215) | def __init__(self, soft_mode=False, gamma=5, useDET=False, useDTT=Fals... method forward (line 256) | def forward(self, x): method hard_reset (line 317) | def hard_reset(self): method soft_reset (line 323) | def soft_reset(self): method reset (line 329) | def reset(self): FILE: examples/Perception_and_Learning/IllusionPerception/AbuttingGratingIllusion/distortion/abutting_grating_illusion/abutting_grating_distortion.py function save_image (line 30) | def save_image(image, filename): function get_mnist_data (line 37) | def get_mnist_data(train = False, batch_size = 100): function get_silhouette_data (line 56) | def get_silhouette_data(path): function ag_distort_28 (line 75) | def ag_distort_28(imgs, threshold=0, interval=4, phase=2, direction=(1,0)): function transform_224 (line 95) | def transform_224(imgs): function ag_distort_224 (line 100) | def ag_distort_224(imgs, threshold=0, interval=8, phase=4, direction=(1,... function ag_distort_silhouette (line 123) | def ag_distort_silhouette(imgs, threshold=0.5, interval=2, phase=1, dire... FILE: examples/Perception_and_Learning/MultisensoryIntegration/code/MultisensoryIntegrationDEMO_AM.py class AMNet (line 10) | class AMNet(nn.Module): method __init__ (line 11) | def __init__(self, method forward (line 28) | def forward(self, x): function get_concept_dataset_dic_and_AM_initial_weights_lst (line 35) | def get_concept_dataset_dic_and_AM_initial_weights_lst(BBSR_path): function convert_vec_into_spike_trains (line 76) | def convert_vec_into_spike_trains(each_concept_vec): function reducing_to_binarycode (line 84) | def reducing_to_binarycode(post_neuron_states_lst, tolerance): FILE: examples/Perception_and_Learning/MultisensoryIntegration/code/MultisensoryIntegrationDEMO_IM.py class IMNet (line 12) | class IMNet(nn.Module): method __init__ (line 13) | def __init__(self, method forward (line 30) | def forward(self, x): function get_concept_dataset_dic_and_initial_weights_lst (line 37) | def get_concept_dataset_dic_and_initial_weights_lst(BBSR_path): function convert_vec_into_spike_trains (line 70) | def convert_vec_into_spike_trains(each_concept_vec): function reducing_to_binarycode (line 78) | def reducing_to_binarycode(post_neuron_states_lst, tolerance): FILE: examples/Perception_and_Learning/MultisensoryIntegration/code/measure_and_visualization.py function get_concept_dataset_dic_and_initial_weights_lst (line 4) | def get_concept_dataset_dic_and_initial_weights_lst(BBSR_path): function load_binarycode_dic (line 36) | def load_binarycode_dic(filename): function load_m_dataset_concept_set_lst (line 42) | def load_m_dataset_concept_set_lst(m_dataset_name): function load_McRae_concept_feature_lst (line 48) | def load_McRae_concept_feature_lst(): function load_CSLB_concept_feature_lst (line 64) | def load_CSLB_concept_feature_lst(): function get_m_dataset_concept_k_similar_concepts_dic (line 82) | def get_m_dataset_concept_k_similar_concepts_dic(m_dataset_name, overlap... function get_dataset_concept_ME_dic (line 101) | def get_dataset_concept_ME_dic(origin_dataset_dic): function get_dataset_concept_k_similar_concepts_ranking_dic_dic (line 113) | def get_dataset_concept_k_similar_concepts_ranking_dic_dic (dataset_dic,... function get_vec_Harmming_similarity (line 131) | def get_vec_Harmming_similarity(concept1_vecstr, concept2_vecstr): function get_ME_kAR_corr (line 135) | def get_ME_kAR_corr(binarycode_type, concept_ME_dic, m_dataset, k): function visualize_results (line 175) | def visualize_results(ME_lst, raking_mean_lst, jointplot_file): FILE: examples/Perception_and_Learning/NeuEvo/auto_augment.py class ImageNetPolicy (line 14) | class ImageNetPolicy(object): method __init__ (line 28) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 60) | def __call__(self, img): method __repr__ (line 64) | def __repr__(self): class CIFAR10Policy (line 68) | class CIFAR10Policy(object): method __init__ (line 82) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 114) | def __call__(self, img): method __repr__ (line 118) | def __repr__(self): class SVHNPolicy (line 122) | class SVHNPolicy(object): method __init__ (line 136) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 168) | def __call__(self, img): method __repr__ (line 172) | def __repr__(self): class SubPolicy (line 176) | class SubPolicy(object): method __init__ (line 178) | def __init__(self, method __call__ (line 269) | def __call__(self, img): FILE: examples/Perception_and_Learning/NeuEvo/main.py function _parse_args (line 345) | def _parse_args(): function main (line 362) | def main(): function train_epoch (line 722) | def train_epoch( function validate (line 857) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/Perception_and_Learning/NeuEvo/separate_loss.py class MseSeparateLoss (line 10) | class MseSeparateLoss(nn.modules.loss._Loss): method __init__ (line 12) | def __init__(self, weight=0.1, size_average=None, ignore_index=-100, method forward (line 19) | def forward(self, input1, target1, input2): class ConvSeparateLoss (line 26) | class ConvSeparateLoss(nn.modules.loss._Loss): method __init__ (line 29) | def __init__(self, loss1_fn, weight=0.1, size_average=None, ignore_ind... method forward (line 36) | def forward(self, input1, target1, input2): class TriSeparateLoss (line 59) | class TriSeparateLoss(nn.modules.loss._Loss): method __init__ (line 62) | def __init__(self, loss1_fn, weight=0.1, size_average=None, ignore_ind... method forward (line 69) | def forward(self, input1, target1, input2): FILE: examples/Perception_and_Learning/NeuEvo/train.py class TrainNetwork (line 75) | class TrainNetwork(object): method __init__ (line 78) | def __init__(self, args): method _init_log (line 87) | def _init_log(self): method _init_device (line 100) | def _init_device(self): method _init_data_queue (line 115) | def _init_data_queue(self): method _init_model (line 136) | def _init_model(self): method run (line 195) | def run(self): method train (line 232) | def train(self): method infer (line 267) | def infer(self): FILE: examples/Perception_and_Learning/NeuEvo/train_search.py function main (line 138) | def main(): function train (line 297) | def train(epoch, train_queue, valid_queue, model, architect, criterion, ... function infer (line 352) | def infer(valid_queue, model, criterion): FILE: examples/Perception_and_Learning/NeuEvo/utils.py class AvgrageMeter (line 21) | class AvgrageMeter(object): method __init__ (line 23) | def __init__(self): method reset (line 26) | def reset(self): method update (line 31) | def update(self, val, n=1): function accuracy (line 37) | def accuracy(output, target, topk=(1,)): class Cutout (line 57) | class Cutout(object): method __init__ (line 58) | def __init__(self, length): method __call__ (line 61) | def __call__(self, img): function _data_transforms_cifar (line 79) | def _data_transforms_cifar(args): function count_parameters_in_MB (line 112) | def count_parameters_in_MB(model): function save_checkpoint (line 116) | def save_checkpoint(state, is_best, save): function save (line 124) | def save(model, model_path): function load (line 128) | def load(model, model_path): function drop_path (line 132) | def drop_path(x, drop_prob): function create_exp_dir (line 142) | def create_exp_dir(path, scripts_to_save=None): function calc_time (line 154) | def calc_time(seconds): function save_file (line 161) | def save_file(recoder, path='./', back_connection=False): FILE: examples/Perception_and_Learning/QSNN/main.py function int2onehot (line 39) | def int2onehot(label, classes, factor): function train (line 45) | def train(net, epochs, lr): FILE: examples/Perception_and_Learning/UnsupervisedSTDP/codef.py class STDPConv (line 46) | class STDPConv(nn.Module): method __init__ (line 47) | def __init__(self, in_planes, out_planes, kernel_size, stride, padding... method mem_update (line 65) | def mem_update(self, x, onespike=True): # b,c,h,w method forward (line 77) | def forward(self, x, T=None, onespike=True): method reset (line 107) | def reset(self): method normgrad (line 110) | def normgrad(self, force=False): method normweight (line 121) | def normweight(self, clip=False): method getthresh (line 136) | def getthresh(self, scale): class STDPLinear (line 143) | class STDPLinear(nn.Module): method __init__ (line 144) | def __init__(self, in_planes, out_planes, method mem_update (line 161) | def mem_update(self, x, onespike=True): # b,c,h,w method forward (line 176) | def forward(self, x, T, onespike=True): method reset (line 204) | def reset(self): method normgrad (line 207) | def normgrad(self, force=False): method normweight (line 218) | def normweight(self, clip=False): method getthresh (line 231) | def getthresh(self, scale): method updatethresh (line 236) | def updatethresh(self, plus=0.05): class STDPFlatten (line 243) | class STDPFlatten(nn.Module): method __init__ (line 244) | def __init__(self, start_dim=0, end_dim=-1): method forward (line 248) | def forward(self, x, T): # [batch,T,c,w,h] class STDPMaxPool (line 253) | class STDPMaxPool(nn.Module): method __init__ (line 254) | def __init__(self, kernel_size, stride, padding, static=True): method forward (line 259) | def forward(self, x, T): # [batch,T,c,w,h] class Normliaze (line 274) | class Normliaze(nn.Module): method __init__ (line 275) | def __init__(self, static=True): method forward (line 279) | def forward(self, x, T): # [batch,T,c,w,h] class voting (line 287) | class voting(nn.Module): method __init__ (line 289) | def __init__(self, shape): method assign_labels (line 293) | def assign_labels(self, spikes, labels, rates=None, n_labels=10, alpha... method get_label (line 315) | def get_label(self, spikes): class Conv_Net (line 333) | class Conv_Net(nn.Module): method __init__ (line 334) | def __init__(self): method forward (line 351) | def forward(self, x, inlayer, outlayer, T, onespike=True): # [b,t,w,h] method normgrad (line 357) | def normgrad(self, layer, force=False): method normweight (line 360) | def normweight(self, layer, clip=False): method updatethresh (line 363) | def updatethresh(self, layer, plus=0.05): method reset (line 366) | def reset(self, layer): function plot_confusion_matrix (line 374) | def plot_confusion_matrix(cm, classes, normalize=True, title='Test Confu... FILE: examples/Perception_and_Learning/img_cls/bp/main.py function _parse_args (line 348) | def _parse_args(): function resnet50d_pretrained (line 366) | def resnet50d_pretrained(*args, **kwargs): function main (line 373) | def main(): function train_epoch (line 745) | def train_epoch( function validate (line 895) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/Perception_and_Learning/img_cls/bp/main_backei.py function train (line 69) | def train(epoch): function eval (line 98) | def eval(epoch): function main (line 119) | def main(): FILE: examples/Perception_and_Learning/img_cls/bp/main_simplified.py function _parse_args (line 189) | def _parse_args(): function main (line 206) | def main(): function train_epoch (line 366) | def train_epoch( function validate (line 449) | def validate(model, loader, loss_fn, args, log_suffix='', visualize=Fals... FILE: examples/Perception_and_Learning/img_cls/glsnn/cls_glsnn.py function train (line 52) | def train(epoch): function eval (line 81) | def eval(epoch): function main (line 101) | def main(): FILE: examples/Perception_and_Learning/img_cls/spiking_capsnet/spikingcaps.py class myLIFnode (line 21) | class myLIFnode(LIFNode): method __init__ (line 22) | def __init__(self, threshold=0.5, tau=2., *args, **kwargs): method integral (line 25) | def integral(self, inputs): class ConvLayer (line 30) | class ConvLayer(nn.Module): method __init__ (line 31) | def __init__(self, in_channels=1, out_channels=256, kernel_size=9): method forward (line 35) | def forward(self, x): class PrimaryCaps (line 39) | class PrimaryCaps(nn.Module): method __init__ (line 40) | def __init__(self, num_capsules=8, in_channels=256, out_channels=32, k... method forward (line 47) | def forward(self, x): class DigitCaps (line 55) | class DigitCaps(nn.Module): method __init__ (line 56) | def __init__(self, num_capsules=10, num_routes=32 * 6 * 6, in_channels... method forward (line 69) | def forward(self, x): class DigitCaps2 (line 78) | class DigitCaps2(nn.Module): method __init__ (line 79) | def __init__(self, num_capsules=10, num_routes=32 * 6 * 6): method forward (line 87) | def forward(self, u_hat): method init_bij (line 92) | def init_bij(self): class Decoder (line 97) | class Decoder(nn.Module): method __init__ (line 98) | def __init__(self): method forward (line 102) | def forward(self, x): class CapsNet (line 108) | class CapsNet(nn.Module): method __init__ (line 109) | def __init__(self): method forward (line 122) | def forward(self, data, time_window=5, train=True): method init (line 152) | def init(self): function evaluate (line 159) | def evaluate(test_iter, net, device): FILE: examples/Perception_and_Learning/img_cls/transfer_for_dvs/GradCAM_visualization.py function get_proj (line 366) | def get_proj(self): function event_vis_raw (line 415) | def event_vis_raw(x): function get_dataloader_ncal (line 449) | def get_dataloader_ncal(step, **kwargs): function _parse_args (line 486) | def _parse_args(): function main (line 503) | def main(): function event_frame_plot_2d (line 848) | def event_frame_plot_2d(event): FILE: examples/Perception_and_Learning/img_cls/transfer_for_dvs/datasets.py class TransferSampler (line 50) | class TransferSampler(torch.utils.data.sampler.Sampler): method __init__ (line 56) | def __init__(self, indices): method __iter__ (line 59) | def __iter__(self): method __len__ (line 62) | def __len__(self): class Transfer_DataSet (line 65) | class Transfer_DataSet(torchvision.datasets.VisionDataset): method __init__ (line 66) | def __init__(self, data, label): method __getitem__ (line 71) | def __getitem__(self, mask): method __len__ (line 76) | def __len__(self): class ConvertHSV (line 81) | class ConvertHSV(object): method __init__ (line 87) | def __init__(self): method __call__ (line 91) | def __call__(self, img): function unpack_mix_param (line 103) | def unpack_mix_param(args): function build_transform (line 116) | def build_transform(is_train, img_size, use_hsv=True): function build_dataset (line 167) | def build_dataset(is_train, img_size, dataset, path, same_da=False, use_... class MNISTData (line 199) | class MNISTData(object): method __init__ (line 204) | def __init__(self, method get_data_loaders (line 221) | def get_data_loaders(self): method get_standard_data (line 235) | def get_standard_data(self): function get_mnist_data (line 246) | def get_mnist_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_fashion_data (line 292) | def get_fashion_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_cifar10_data (line 325) | def get_cifar10_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_cifar100_data (line 351) | def get_cifar100_data(batch_size, num_workers=8, same_data=False, *args,... function get_transfer_cifar10_data (line 374) | def get_transfer_cifar10_data(batch_size, num_workers=8, same_da=False, ... function get_combined_cifar10_data (line 399) | def get_combined_cifar10_data(batch_size, num_workers=8, same_da=False, ... function get_transfer_CALTECH101_data (line 413) | def get_transfer_CALTECH101_data(batch_size, num_workers=8, same_da=Fals... function get_combined_CALTECH101_data (line 435) | def get_combined_CALTECH101_data(batch_size, num_workers=8, same_da=Fals... function get_TinyImageNet_data (line 457) | def get_TinyImageNet_data(batch_size, num_workers=8, same_da=False, *arg... function get_transfer_imnet_data (line 490) | def get_transfer_imnet_data(args, _logger, data_config, num_aug_splits, ... function get_dvsg_data (line 529) | def get_dvsg_data(batch_size, step, **kwargs): function get_dvsc10_data (line 629) | def get_dvsc10_data(batch_size, step, dvs_da=False, **kwargs): function get_transfer_dvsc10_data (line 747) | def get_transfer_dvsc10_data(batch_size, step, dvs_da=False, **kwargs): function get_NCALTECH101_data (line 837) | def get_NCALTECH101_data(batch_size, step, dvs_da=False, **kwargs): function get_transfer_NCALTECH101_data (line 974) | def get_transfer_NCALTECH101_data(batch_size, step, dvs_da=False, **kwar... function get_NCARS_data (line 1067) | def get_NCARS_data(batch_size, step, **kwargs): function get_nomni_data (line 1165) | def get_nomni_data(batch_size, train_portion=1., **kwargs): function get_transfer_omni_data (line 1229) | def get_transfer_omni_data(batch_size, train_portion=1., **kwargs): function get_esimnet_data (line 1259) | def get_esimnet_data(batch_size, step, **kwargs): function get_CUB2002011_data (line 1359) | def get_CUB2002011_data(batch_size, num_workers=8, same_da=False, *args,... function get_StanfordCars_data (line 1390) | def get_StanfordCars_data(batch_size, num_workers=8, same_da=False, *arg... function get_StanfordDogs_data (line 1421) | def get_StanfordDogs_data(batch_size, num_workers=8, same_da=False, *arg... function get_FGVCAircraft_data (line 1453) | def get_FGVCAircraft_data(batch_size, num_workers=8, same_da=False, *arg... function get_Flowers102_data (line 1485) | def get_Flowers102_data(batch_size, num_workers=8, same_da=False, *args,... FILE: examples/Perception_and_Learning/img_cls/transfer_for_dvs/main.py function _parse_args (line 359) | def _parse_args(): function main (line 376) | def main(): function train_epoch (line 745) | def train_epoch( function validate (line 944) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/Perception_and_Learning/img_cls/transfer_for_dvs/main_transfer.py function _parse_args (line 384) | def _parse_args(): function main (line 401) | def main(): function train_epoch (line 860) | def train_epoch( function validate (line 1211) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/Perception_and_Learning/img_cls/transfer_for_dvs/main_visual_losslandscape.py function _parse_args (line 402) | def _parse_args(): function main (line 419) | def main(): FILE: examples/Snn_safety/DPSNN/load_data.py class CustomDataset (line 23) | class CustomDataset(Dataset): method __init__ (line 27) | def __init__(self, dataset, indices): method __len__ (line 31) | def __len__(self): method __getitem__ (line 34) | def __getitem__(self, item): function load_static_data (line 39) | def load_static_data(data_root, batch_size, dataset): function load_dvs10_data (line 107) | def load_dvs10_data(batch_size, step, **kwargs): function load_nmnist_data (line 161) | def load_nmnist_data(batch_size, step, **kwargs): FILE: examples/Snn_safety/DPSNN/main_dpsnn.py function train (line 38) | def train(model, device, train_loader, optimizer, epoch, privacy_engine): function test (line 76) | def test(model, device, test_loader): function run (line 104) | def run(): FILE: examples/Snn_safety/DPSNN/model.py class TEP (line 13) | class TEP(nn.Module): method __init__ (line 14) | def __init__(self, step, channel, device=None, dtype=None): method forward (line 21) | def forward(self, x): class BaseConvNet (line 33) | class BaseConvNet(BaseModule, abc.ABC): method __init__ (line 34) | def __init__(self, method _create_feature (line 77) | def _create_feature(self): method _create_fc (line 81) | def _create_fc(self): method forward (line 84) | def forward(self, inputs): class LayerWiseConvModule (line 123) | class LayerWiseConvModule(nn.Module): method __init__ (line 136) | def __init__(self, method forward (line 164) | def forward(self, x): class LayerWiseLinearModule (line 177) | class LayerWiseLinearModule(nn.Module): method __init__ (line 188) | def __init__(self, method forward (line 217) | def forward(self, x): class LayWiseConvNet (line 239) | class LayWiseConvNet(BaseConvNet): method __init__ (line 240) | def __init__(self, method _create_feature (line 262) | def _create_feature(self): method _create_fc (line 303) | def _create_fc(self): function cifar_convnet (line 314) | def cifar_convnet(step, function dvs_convnet (line 342) | def dvs_convnet(step, class SimpleSNN (line 372) | class SimpleSNN(BaseModule, abc.ABC): method __init__ (line 373) | def __init__(self, method forward (line 400) | def forward(self, inputs): FILE: examples/Snn_safety/RandHet-SNN/evaluate.py function get_args (line 28) | def get_args(): function evaluate_attack (line 44) | def evaluate_attack(model, test_loader, args, atk, atk_name, logger): function main (line 74) | def main(): FILE: examples/Snn_safety/RandHet-SNN/my_node.py class RHLIFNode (line 4) | class RHLIFNode(BaseNode): method __init__ (line 23) | def __init__(self, threshold=0.5, tau=0., sigma=1.0, act_fun=AtanGrad,... method integral (line 36) | def integral(self, inputs): method calc_spike (line 40) | def calc_spike(self): method n_reset (line 45) | def n_reset(self): class RHLIFNode2 (line 52) | class RHLIFNode2(BaseNode): method __init__ (line 71) | def __init__(self, threshold=0.5, tau=0., sigma=1.0, act_fun=AtanGrad,... method integral (line 85) | def integral(self, inputs): method calc_spike (line 91) | def calc_spike(self): method n_reset (line 96) | def n_reset(self): FILE: examples/Snn_safety/RandHet-SNN/sew_resnet.py function sew_function (line 16) | def sew_function(x: torch.Tensor, y: torch.Tensor, cnf: str): function conv3x3 (line 27) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 33) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 38) | class BasicBlock(nn.Module): method __init__ (line 41) | def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, method forward (line 63) | def forward(self, x): method extra_repr (line 81) | def extra_repr(self) -> str: class Bottleneck (line 85) | class Bottleneck(nn.Module): method __init__ (line 94) | def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, method forward (line 116) | def forward(self, x): method extra_repr (line 138) | def extra_repr(self) -> str: class SEWResNet19 (line 142) | class SEWResNet19(BaseModule): method __init__ (line 143) | def __init__(self, block, layers, num_classes=1000, step=8, encode_typ... method _make_layer (line 206) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False, c... method _forward_impl (line 231) | def _forward_impl(self, inputs): method _forward_once (line 263) | def _forward_once(self, x): method forward (line 282) | def forward(self, x): FILE: examples/Snn_safety/RandHet-SNN/train.py function get_args (line 28) | def get_args(): function main (line 63) | def main(): FILE: examples/Snn_safety/RandHet-SNN/utils.py function get_norm_stat (line 14) | def get_norm_stat(mean, std): function clamp (line 23) | def clamp(X, lower_limit, upper_limit): function normalize_fn (line 27) | def normalize_fn(tensor, mean, std): class NormalizeByChannelMeanStd (line 35) | class NormalizeByChannelMeanStd(nn.Module): method __init__ (line 36) | def __init__(self, mean, std): method forward (line 45) | def forward(self, tensor): method extra_repr (line 48) | def extra_repr(self): function get_loaders (line 52) | def get_loaders(dir_, batch_size, dataset='cifar10', worker=4, norm=True): function evaluate_standard (line 107) | def evaluate_standard(test_loader, model, args): function orthogonal_retraction (line 124) | def orthogonal_retraction(model, beta=0.002): FILE: examples/Social_Cognition/FOToM/algorithms/ToM_class.py class ToM1 (line 7) | class ToM1(object): method __init__ (line 14) | def __init__(self, tom_base, alg_types, agent_types, num_lm, device, h... method _agent_tom1_init (line 34) | def _agent_tom1_init(self): method _get_index1 (line 48) | def _get_index1(self, lst=None, item=''): method c_function (line 51) | def c_function(self, tom0_actions_q, tom1_actions_q): method tom1_output (line 70) | def tom1_output(self, agent_i, adv_indx, good_indx, obs_, acs_pre_): FILE: examples/Social_Cognition/FOToM/algorithms/maddpg.py class MADDPG (line 17) | class MADDPG(object): method __init__ (line 18) | def __init__(self, agent_init_params, alg_types, device, method policies (line 55) | def policies(self): method target_policies (line 59) | def target_policies(self): method scale_noise (line 62) | def scale_noise(self, scale): method reset_noise (line 71) | def reset_noise(self): method step (line 75) | def step(self, observations, explore=False): method update (line 87) | def update(self, sample, agent_i, parallel=False, logger=None): method update_all_targets (line 179) | def update_all_targets(self): method prep_training (line 189) | def prep_training(self, device='gpu'): method prep_rollouts (line 216) | def prep_rollouts(self, device='cpu'): method save (line 229) | def save(self, filename): method init_from_env (line 239) | def init_from_env(cls, env, device, agent_alg="MADDPG", adversary_alg=... method init_from_save (line 291) | def init_from_save(cls, filename): class MADDPG_RNN (line 302) | class MADDPG_RNN(object): method __init__ (line 306) | def __init__(self, agent_init_params, alg_types, method _init_agent (line 341) | def _init_agent(self, n_rollout_threads): method policies (line 347) | def policies(self, len_ep): method target_policies (line 353) | def target_policies(self, len_ep): method scale_noise (line 358) | def scale_noise(self, scale): method reset_noise (line 367) | def reset_noise(self): method step (line 371) | def step(self, observations, explore=False): method _compute_rnn (line 383) | def _compute_rnn(self, fn, hidden, inputs, logit): method update (line 398) | def update(self, sample, agent_i, parallel=False, logger=None): method update_all_targets (line 481) | def update_all_targets(self): method prep_training (line 491) | def prep_training(self, device='gpu'): method prep_rollouts (line 518) | def prep_rollouts(self, device='cpu'): method save (line 531) | def save(self, filename): method init_from_env (line 541) | def init_from_env(cls, env, agent_alg="MADDPG", adversary_alg="MADDPG_... method init_from_save (line 580) | def init_from_save(cls, filename): FILE: examples/Social_Cognition/FOToM/algorithms/tom11.py class ToM_decision11 (line 20) | class ToM_decision11(object): method __init__ (line 22) | def __init__(self, agent_init_params, alg_types, agent_types, num_lm, method policies (line 87) | def policies(self): method target_policies (line 91) | def target_policies(self): method scale_noise (line 94) | def scale_noise(self, scale): method reset_noise (line 103) | def reset_noise(self): method _get_index1 (line 107) | def _get_index1(self, lst=None, item=''): method _agent_tom_init (line 110) | def _agent_tom_init(self): method step (line 124) | def step(self, observations, actions_pre, explore=False): #simple_tag method _get_obs (line 195) | def _get_obs(self, observations, action_tom): method train_tom0 (line 205) | def train_tom0(self, sample, agent_i): method tom1_infer_other (line 245) | def tom1_infer_other(self, sample): method tom0_output (line 328) | def tom0_output(self, sample): method update (line 365) | def update(self, sample, agent_i, parallel=False, logger=None, sample_... method update_all_targets (line 509) | def update_all_targets(self): method prep_training (line 519) | def prep_training(self, device='gpu'): method prep_rollouts (line 563) | def prep_rollouts(self, device='cpu'): method save (line 576) | def save(self, filename): method init_from_env (line 587) | def init_from_env(cls, env, config, device, agent_alg, adversary_alg, method init_from_save (line 647) | def init_from_save(cls, filename): method get_params (line 661) | def get_params(self): method load_params (line 671) | def load_params(self, params): FILE: examples/Social_Cognition/FOToM/common/distributions.py class Pd (line 10) | class Pd(object): method flatparam (line 14) | def flatparam(self): method mode (line 16) | def mode(self): method logp (line 18) | def logp(self, x): method kl (line 20) | def kl(self, other): method entropy (line 22) | def entropy(self): method sample (line 24) | def sample(self): class PdType (line 27) | class PdType(object): method pdclass (line 31) | def pdclass(self): method pdfromflat (line 33) | def pdfromflat(self, flat): method param_shape (line 35) | def param_shape(self): method sample_shape (line 37) | def sample_shape(self): method sample_dtype (line 39) | def sample_dtype(self): method param_placeholder (line 42) | def param_placeholder(self, prepend_shape, name=None): method sample_placeholder (line 44) | def sample_placeholder(self, prepend_shape, name=None): class CategoricalPdType (line 47) | class CategoricalPdType(PdType): method __init__ (line 48) | def __init__(self, ncat): method pdclass (line 50) | def pdclass(self): method param_shape (line 52) | def param_shape(self): method sample_shape (line 54) | def sample_shape(self): method sample_dtype (line 56) | def sample_dtype(self): class SoftCategoricalPdType (line 59) | class SoftCategoricalPdType(PdType): method __init__ (line 60) | def __init__(self, ncat): method pdclass (line 62) | def pdclass(self): method param_shape (line 64) | def param_shape(self): method sample_shape (line 66) | def sample_shape(self): method sample_dtype (line 68) | def sample_dtype(self): class MultiCategoricalPdType (line 71) | class MultiCategoricalPdType(PdType): method __init__ (line 72) | def __init__(self, low, high): method pdclass (line 76) | def pdclass(self): method pdfromflat (line 78) | def pdfromflat(self, flat): method param_shape (line 80) | def param_shape(self): method sample_shape (line 82) | def sample_shape(self): method sample_dtype (line 84) | def sample_dtype(self): class SoftMultiCategoricalPdType (line 87) | class SoftMultiCategoricalPdType(PdType): method __init__ (line 88) | def __init__(self, low, high): method pdclass (line 92) | def pdclass(self): method pdfromflat (line 94) | def pdfromflat(self, flat): method param_shape (line 96) | def param_shape(self): method sample_shape (line 98) | def sample_shape(self): method sample_dtype (line 100) | def sample_dtype(self): class DiagGaussianPdType (line 103) | class DiagGaussianPdType(PdType): method __init__ (line 104) | def __init__(self, size): method pdclass (line 106) | def pdclass(self): method param_shape (line 108) | def param_shape(self): method sample_shape (line 110) | def sample_shape(self): method sample_dtype (line 112) | def sample_dtype(self): class BernoulliPdType (line 115) | class BernoulliPdType(PdType): method __init__ (line 116) | def __init__(self, size): method pdclass (line 118) | def pdclass(self): method param_shape (line 120) | def param_shape(self): method sample_shape (line 122) | def sample_shape(self): method sample_dtype (line 124) | def sample_dtype(self): class CategoricalPd (line 150) | class CategoricalPd(Pd): method __init__ (line 151) | def __init__(self, logits): method flatparam (line 153) | def flatparam(self): method mode (line 155) | def mode(self): method logp (line 157) | def logp(self, x): method kl (line 159) | def kl(self, other): method entropy (line 168) | def entropy(self): method sample (line 174) | def sample(self): method fromflat (line 178) | def fromflat(cls, flat): class SoftCategoricalPd (line 181) | class SoftCategoricalPd(Pd): method __init__ (line 182) | def __init__(self, logits): method flatparam (line 184) | def flatparam(self): method mode (line 186) | def mode(self): method logp (line 188) | def logp(self, x): method kl (line 190) | def kl(self, other): method entropy (line 199) | def entropy(self): method sample (line 205) | def sample(self): method fromflat (line 209) | def fromflat(cls, flat): class MultiCategoricalPd (line 212) | class MultiCategoricalPd(Pd): method __init__ (line 213) | def __init__(self, low, high, flat): method flatparam (line 217) | def flatparam(self): method mode (line 219) | def mode(self): method logp (line 221) | def logp(self, x): method kl (line 223) | def kl(self, other): method entropy (line 227) | def entropy(self): method sample (line 229) | def sample(self): method fromflat (line 232) | def fromflat(cls, flat): class SoftMultiCategoricalPd (line 235) | class SoftMultiCategoricalPd(Pd): # doesn't work yet method __init__ (line 236) | def __init__(self, low, high, flat): method flatparam (line 240) | def flatparam(self): method mode (line 242) | def mode(self): method logp (line 247) | def logp(self, x): method kl (line 249) | def kl(self, other): method entropy (line 253) | def entropy(self): method sample (line 255) | def sample(self): method fromflat (line 261) | def fromflat(cls, flat): class DiagGaussianPd (line 264) | class DiagGaussianPd(Pd): method __init__ (line 265) | def __init__(self, flat): method flatparam (line 271) | def flatparam(self): method mode (line 273) | def mode(self): method logp (line 275) | def logp(self, x): method kl (line 279) | def kl(self, other): method entropy (line 282) | def entropy(self): method sample (line 284) | def sample(self): method fromflat (line 287) | def fromflat(cls, flat): class BernoulliPd (line 290) | class BernoulliPd(Pd): method __init__ (line 291) | def __init__(self, logits): method flatparam (line 294) | def flatparam(self): method mode (line 296) | def mode(self): method logp (line 298) | def logp(self, x): method kl (line 300) | def kl(self, other): method entropy (line 302) | def entropy(self): method sample (line 304) | def sample(self): method fromflat (line 309) | def fromflat(cls, flat): function make_pdtype (line 312) | def make_pdtype(ac_space): function shape_el (line 328) | def shape_el(v, i): FILE: examples/Social_Cognition/FOToM/common/tile_images.py function tile_images (line 3) | def tile_images(img_nhwc): FILE: examples/Social_Cognition/FOToM/common/vec_env/vec_env.py class AlreadySteppingError (line 7) | class AlreadySteppingError(Exception): method __init__ (line 13) | def __init__(self): class NotSteppingError (line 18) | class NotSteppingError(Exception): method __init__ (line 24) | def __init__(self): class VecEnv (line 29) | class VecEnv(ABC): method __init__ (line 43) | def __init__(self, num_envs, observation_space, action_space): method reset (line 49) | def reset(self): method step_async (line 61) | def step_async(self, actions): method step_wait (line 73) | def step_wait(self): method close_extras (line 86) | def close_extras(self): method close (line 93) | def close(self): method step (line 101) | def step(self, actions): method render (line 110) | def render(self, mode='human'): method get_images (line 121) | def get_images(self): method unwrapped (line 128) | def unwrapped(self): method get_viewer (line 134) | def get_viewer(self): class VecEnvWrapper (line 140) | class VecEnvWrapper(VecEnv): method __init__ (line 146) | def __init__(self, venv, observation_space=None, action_space=None): method step_async (line 152) | def step_async(self, actions): method reset (line 156) | def reset(self): method step_wait (line 160) | def step_wait(self): method close (line 163) | def close(self): method render (line 166) | def render(self, mode='human'): method get_images (line 169) | def get_images(self): method __getattr__ (line 172) | def __getattr__(self, name): class VecEnvObservationWrapper (line 177) | class VecEnvObservationWrapper(VecEnvWrapper): method process (line 179) | def process(self, obs): method reset (line 182) | def reset(self): method step_wait (line 186) | def step_wait(self): class CloudpickleWrapper (line 190) | class CloudpickleWrapper(object): method __init__ (line 195) | def __init__(self, x): method __getstate__ (line 198) | def __getstate__(self): method __setstate__ (line 202) | def __setstate__(self, ob): function clear_mpi_env_vars (line 208) | def clear_mpi_env_vars(): FILE: examples/Social_Cognition/FOToM/evaluate.py function display_frames_as_gif (line 15) | def display_frames_as_gif(frames): function make_parallel_env (line 21) | def make_parallel_env(env_id, n_rollout_threads, discrete_action, num_go... function run (line 34) | def run(config): FILE: examples/Social_Cognition/FOToM/main.py function get_common_args (line 22) | def get_common_args(): function make_parallel_env (line 76) | def make_parallel_env(env_id, n_rollout_threads, seed, discrete_action, ... function run (line 89) | def run(config): FILE: examples/Social_Cognition/FOToM/multiagent/core.py class EntityState (line 4) | class EntityState(object): method __init__ (line 5) | def __init__(self): class AgentState (line 12) | class AgentState(EntityState): method __init__ (line 13) | def __init__(self): class Action (line 19) | class Action(object): method __init__ (line 20) | def __init__(self): class Entity (line 27) | class Entity(object): method __init__ (line 28) | def __init__(self): method mass (line 50) | def mass(self): class Landmark (line 54) | class Landmark(Entity): method __init__ (line 55) | def __init__(self): class Agent (line 59) | class Agent(Entity): method __init__ (line 60) | def __init__(self): class World (line 82) | class World(object): method __init__ (line 83) | def __init__(self): method entities (line 103) | def entities(self): method policy_agents (line 108) | def policy_agents(self): method scripted_agents (line 113) | def scripted_agents(self): method step (line 117) | def step(self): method apply_action_force (line 134) | def apply_action_force(self, p_force): method apply_environment_force (line 143) | def apply_environment_force(self, p_force): method integrate_state (line 158) | def integrate_state(self, p_force): method update_agent_state (line 171) | def update_agent_state(self, agent): method get_collision_force (line 180) | def get_collision_force(self, entity_a, entity_b): FILE: examples/Social_Cognition/FOToM/multiagent/environment.py class MultiAgentEnv (line 9) | class MultiAgentEnv(gym.Env): method __init__ (line 14) | def __init__(self, world, reset_callback=None, reward_callback=None, method step (line 80) | def step(self, action_n): method reset (line 106) | def reset(self): method _get_info (line 119) | def _get_info(self, agent): method _get_obs (line 125) | def _get_obs(self, agent): method _get_done (line 132) | def _get_done(self, agent): method _get_reward (line 138) | def _get_reward(self, agent): method _set_action (line 144) | def _set_action(self, action, agent, action_space, time=None): method _reset_render (line 195) | def _reset_render(self): method render (line 200) | def render(self, mode='human'): method _make_receptor_locations (line 266) | def _make_receptor_locations(self, agent): class BatchMultiAgentEnv (line 288) | class BatchMultiAgentEnv(gym.Env): method __init__ (line 294) | def __init__(self, env_batch): method n (line 298) | def n(self): method action_space (line 302) | def action_space(self): method observation_space (line 306) | def observation_space(self): method step (line 309) | def step(self, action_n, time): method reset (line 324) | def reset(self): method render (line 331) | def render(self, mode='human', close=True): FILE: examples/Social_Cognition/FOToM/multiagent/multi_discrete.py class MultiDiscrete (line 9) | class MultiDiscrete(gym.Space): method __init__ (line 25) | def __init__(self, array_of_param_array): method sample (line 30) | def sample(self): method contains (line 36) | def contains(self, x): method shape (line 40) | def shape(self): method __repr__ (line 42) | def __repr__(self): method __eq__ (line 44) | def __eq__(self, other): FILE: examples/Social_Cognition/FOToM/multiagent/policy.py class Policy (line 5) | class Policy(object): method __init__ (line 6) | def __init__(self): method action (line 8) | def action(self, obs): class InteractivePolicy (line 13) | class InteractivePolicy(Policy): method __init__ (line 14) | def __init__(self, env, agent_index): method action (line 24) | def action(self, obs): method key_press (line 43) | def key_press(self, k, mod): method key_release (line 48) | def key_release(self, k, mod): FILE: examples/Social_Cognition/FOToM/multiagent/rendering.py function get_display (line 33) | def get_display(spec): class Viewer (line 46) | class Viewer(object): method __init__ (line 47) | def __init__(self, width, height, display=None): method close (line 67) | def close(self): method window_closed_by_user (line 70) | def window_closed_by_user(self): method set_bounds (line 73) | def set_bounds(self, left, right, bottom, top): method add_geom (line 81) | def add_geom(self, geom): method add_onetime (line 84) | def add_onetime(self, geom): method render (line 87) | def render(self, return_rgb_array=False): method draw_circle (line 116) | def draw_circle(self, radius=10, res=30, filled=True, **attrs): method draw_polygon (line 122) | def draw_polygon(self, v, filled=True, **attrs): method draw_polyline (line 128) | def draw_polyline(self, v, **attrs): method draw_line (line 134) | def draw_line(self, start, end, **attrs): method get_array (line 140) | def get_array(self): function _add_attrs (line 148) | def _add_attrs(geom, attrs): class Geom (line 154) | class Geom(object): method __init__ (line 155) | def __init__(self): method render (line 158) | def render(self): method render1 (line 164) | def render1(self): method add_attr (line 166) | def add_attr(self, attr): method set_color (line 168) | def set_color(self, r, g, b, alpha=1): class Attr (line 171) | class Attr(object): method enable (line 172) | def enable(self): method disable (line 174) | def disable(self): class Transform (line 177) | class Transform(Attr): method __init__ (line 178) | def __init__(self, translation=(0.0, 0.0), rotation=0.0, scale=(1,1)): method enable (line 182) | def enable(self): method disable (line 187) | def disable(self): method set_translation (line 189) | def set_translation(self, newx, newy): method set_rotation (line 191) | def set_rotation(self, new): method set_scale (line 193) | def set_scale(self, newx, newy): class Color (line 196) | class Color(Attr): method __init__ (line 197) | def __init__(self, vec4): method enable (line 199) | def enable(self): class LineStyle (line 202) | class LineStyle(Attr): method __init__ (line 203) | def __init__(self, style): method enable (line 205) | def enable(self): method disable (line 208) | def disable(self): class LineWidth (line 211) | class LineWidth(Attr): method __init__ (line 212) | def __init__(self, stroke): method enable (line 214) | def enable(self): class Point (line 217) | class Point(Geom): method __init__ (line 218) | def __init__(self): method render1 (line 220) | def render1(self): class FilledPolygon (line 225) | class FilledPolygon(Geom): method __init__ (line 226) | def __init__(self, v): method render1 (line 229) | def render1(self): function make_circle (line 244) | def make_circle(radius=10, res=30, filled=True): function make_polygon (line 254) | def make_polygon(v, filled=True): function make_polyline (line 258) | def make_polyline(v): function make_capsule (line 261) | def make_capsule(length, width): class Compound (line 270) | class Compound(Geom): method __init__ (line 271) | def __init__(self, gs): method render1 (line 276) | def render1(self): class PolyLine (line 280) | class PolyLine(Geom): method __init__ (line 281) | def __init__(self, v, close): method render1 (line 287) | def render1(self): method set_linewidth (line 292) | def set_linewidth(self, x): class Line (line 295) | class Line(Geom): method __init__ (line 296) | def __init__(self, start=(0.0, 0.0), end=(0.0, 0.0)): method render1 (line 303) | def render1(self): class Image (line 309) | class Image(Geom): method __init__ (line 310) | def __init__(self, fname, width, height): method render1 (line 317) | def render1(self): class SimpleImageViewer (line 322) | class SimpleImageViewer(object): method __init__ (line 323) | def __init__(self, display=None): method imshow (line 327) | def imshow(self, arr): method close (line 341) | def close(self): method __del__ (line 345) | def __del__(self): FILE: examples/Social_Cognition/FOToM/multiagent/scenario.py class BaseScenario (line 4) | class BaseScenario(object): method make_world (line 6) | def make_world(self): method reset_world (line 9) | def reset_world(self, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/__init__.py function load (line 5) | def load(name): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/hetero_spread.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, num_good_agents=2, num_adversaries=0): method reset_world (line 46) | def reset_world(self, world): method benchmark_data (line 67) | def benchmark_data(self, agent, world): method is_collision (line 86) | def is_collision(self, agent1, agent2): method reward (line 92) | def reward(self, agent, world): method observation (line 126) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 24) | def reset_world(self, world): method reward (line 41) | def reward(self, agent, world): method observation (line 45) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_adversary.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 8) | def make_world(self, num_good_agents=2, num_adversaries=1): method reset_world (line 37) | def reset_world(self, world): method benchmark_data (line 59) | def benchmark_data(self, agent, world): method good_agents (line 71) | def good_agents(self, world): method adversaries (line 75) | def adversaries(self, world): method reward (line 78) | def reward(self, agent, world): method agent_reward (line 82) | def agent_reward(self, agent, world): method adversary_reward (line 111) | def adversary_reward(self, agent, world): method observation (line 123) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_crypto.py class CryptoAgent (line 14) | class CryptoAgent(Agent): method __init__ (line 15) | def __init__(self): class Scenario (line 19) | class Scenario(BaseScenario): method make_world (line 21) | def make_world(self): method reset_world (line 47) | def reset_world(self, world): method benchmark_data (line 78) | def benchmark_data(self, agent, world): method good_listeners (line 83) | def good_listeners(self, world): method good_agents (line 87) | def good_agents(self, world): method adversaries (line 91) | def adversaries(self, world): method reward (line 94) | def reward(self, agent, world): method agent_reward (line 97) | def agent_reward(self, agent, world): method adversary_reward (line 116) | def adversary_reward(self, agent, world): method observation (line 124) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_push.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self, num_good_agents=2, num_adversaries=2): method reset_world (line 33) | def reset_world(self, world): method reward (line 58) | def reward(self, agent, world): method good_agents (line 62) | def good_agents(self, world): method adversaries (line 66) | def adversaries(self, world): method is_collision (line 69) | def is_collision(self, agent1, agent2): method agent_reward (line 75) | def agent_reward(self, agent, world): method adversary_reward (line 104) | def adversary_reward(self, agent, world): method observation (line 130) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_reference.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self, num_good_agents=2, num_adversaries=0): method reset_world (line 26) | def reset_world(self, world): method reward (line 55) | def reward(self, agent, world): method observation (line 61) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_speaker_listener.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 33) | def reset_world(self, world): method benchmark_data (line 59) | def benchmark_data(self, agent, world): method reward (line 63) | def reward(self, agent, world): method observation (line 69) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_spread.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, num_good_agents=2, num_adversaries=2): method reset_world (line 31) | def reset_world(self, world): method benchmark_data (line 47) | def benchmark_data(self, agent, world): method is_collision (line 66) | def is_collision(self, agent1, agent2): method reward (line 72) | def reward(self, agent, world): method observation (line 106) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_tag.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, num_good_agents=1, num_adversaries=3): method reset_world (line 39) | def reset_world(self, world): method benchmark_data (line 57) | def benchmark_data(self, agent, world): method is_collision (line 69) | def is_collision(self, agent1, agent2): method good_agents (line 76) | def good_agents(self, world): method adversaries (line 80) | def adversaries(self, world): method reward (line 84) | def reward(self, agent, world): method agent_reward (line 89) | def agent_reward(self, agent, world): method adversary_reward (line 115) | def adversary_reward(self, agent, world): method observation (line 131) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/multiagent/scenarios/simple_world_comm.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, num_good_agents=2, num_adversaries=4): method set_boundaries (line 59) | def set_boundaries(self, world): method reset_world (line 88) | def reset_world(self, world): method benchmark_data (line 115) | def benchmark_data(self, agent, world): method is_collision (line 126) | def is_collision(self, agent1, agent2): method good_agents (line 134) | def good_agents(self, world): method adversaries (line 138) | def adversaries(self, world): method reward (line 142) | def reward(self, agent, world): method outside_boundary (line 148) | def outside_boundary(self, agent): method agent_reward (line 155) | def agent_reward(self, agent, world): method adversary_reward (line 185) | def adversary_reward(self, agent, world): method observation2 (line 201) | def observation2(self, agent, world): method observation (line 224) | def observation(self, agent, world): FILE: examples/Social_Cognition/FOToM/utils/agents.py class DDPGAgent (line 10) | class DDPGAgent(object): method __init__ (line 15) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, hidden_dim=64, method reset_noise (line 47) | def reset_noise(self): method scale_noise (line 51) | def scale_noise(self, scale): method step (line 57) | def step(self, obs, explore=False): method get_params (line 89) | def get_params(self): method load_params (line 97) | def load_params(self, params): class DDPGAgent_RNN (line 105) | class DDPGAgent_RNN(object): method __init__ (line 110) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, hidden_dim=64, method reset_noise (line 150) | def reset_noise(self): method scale_noise (line 154) | def scale_noise(self, scale): method step (line 160) | def step(self, obs, explore=False): method get_params (line 183) | def get_params(self): method load_params (line 191) | def load_params(self, params): method init_hidden (line 199) | def init_hidden(self, len_ep, policy_hidden=False, policy_target_hidde... class DDPGAgent_SNN (line 211) | class DDPGAgent_SNN(object): method __init__ (line 216) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, output_styl... method reset_noise (line 246) | def reset_noise(self): method scale_noise (line 250) | def scale_noise(self, scale): method step (line 256) | def step(self, obs, explore=False): method get_params (line 297) | def get_params(self): method load_params (line 305) | def load_params(self, params): class DDPGAgent_ToM (line 313) | class DDPGAgent_ToM(object): method __init__ (line 318) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, num_in_mle,... method reset_noise (line 366) | def reset_noise(self): method scale_noise (line 370) | def scale_noise(self, scale): method step (line 376) | def step(self, obs, explore=False): method get_params (line 411) | def get_params(self): method load_params (line 424) | def load_params(self, params): class rDDPGAgent_ToM (line 435) | class rDDPGAgent_ToM(object): method __init__ (line 440) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, num_in_mle,... method reset_noise (line 485) | def reset_noise(self): method scale_noise (line 489) | def scale_noise(self, scale): method step (line 495) | def step(self, obs, explore=False): method get_params (line 530) | def get_params(self): method load_params (line 543) | def load_params(self, params): method init_hidden (line 554) | def init_hidden(self, len_ep, policy_hidden=False, policy_target_hidde... class lDDPGAgent (line 566) | class lDDPGAgent(object): method __init__ (line 571) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, hidden_dim=64, method reset_noise (line 603) | def reset_noise(self): method scale_noise (line 607) | def scale_noise(self, scale): method step (line 613) | def step(self, obs, explore=False): method get_params (line 645) | def get_params(self): method load_params (line 653) | def load_params(self, params): FILE: examples/Social_Cognition/FOToM/utils/buffer.py class ReplayBuffer (line 6) | class ReplayBuffer(object): method __init__ (line 10) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device): method __len__ (line 37) | def __len__(self): method push (line 40) | def push(self, observations, actions, rewards, next_observations, dones): method sample (line 72) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 92) | def get_average_rewards(self, N): class ReplayBuffer_pre (line 99) | class ReplayBuffer_pre(object): method __init__ (line 103) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device): method __len__ (line 132) | def __len__(self): method push (line 135) | def push(self, actions_pre, observations, actions, rewards, next_obser... method sample (line 170) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 194) | def get_average_rewards(self, N): class ReplayBuffer_RNN (line 202) | class ReplayBuffer_RNN(object): method __init__ (line 206) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, ep_dims, ... method __len__ (line 234) | def __len__(self): method push (line 237) | def push(self, observations_ep, actions_ep, rewards_ep, next_observati... method sample (line 278) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 298) | def get_average_rewards(self, N): FILE: examples/Social_Cognition/FOToM/utils/env_wrappers.py function worker (line 9) | def worker(remote, parent_remote, env_fn_wrapper): class SubprocVecEnv (line 42) | class SubprocVecEnv(VecEnv): method __init__ (line 43) | def __init__(self, env_fns, spaces=None): method step_async (line 67) | def step_async(self, actions): method step_wait (line 72) | def step_wait(self): method reset (line 78) | def reset(self): method reset_task (line 83) | def reset_task(self): method close (line 88) | def close(self): class DummyVecEnv (line 101) | class DummyVecEnv(VecEnv): method __init__ (line 102) | def __init__(self, env_fns): method step_async (line 114) | def step_async(self, actions): method step_wait (line 117) | def step_wait(self): method reset (line 128) | def reset(self): method close (line 132) | def close(self): FILE: examples/Social_Cognition/FOToM/utils/make_env.py function make_env (line 15) | def make_env(scenario_name, num_good_agents, num_adversaries, benchmark=... FILE: examples/Social_Cognition/FOToM/utils/misc.py function soft_update (line 9) | def soft_update(target, source, tau): function hard_update (line 22) | def hard_update(target, source): function average_gradients (line 33) | def average_gradients(model): function init_processes (line 41) | def init_processes(rank, size, fn, backend='gloo'): function onehot_from_logits (line 48) | def onehot_from_logits(logits, eps=0.0): function sample_gumbel (line 65) | def sample_gumbel(shape, eps=1e-20, tens_type=torch.FloatTensor): function gumbel_softmax_sample (line 71) | def gumbel_softmax_sample(logits, temperature): function gumbel_softmax (line 77) | def gumbel_softmax(logits, temperature=1.0, hard=False): FILE: examples/Social_Cognition/FOToM/utils/multiprocessing.py function _flatten_list (line 10) | def _flatten_list(l): function worker (line 18) | def worker(remote, parent_remote, env_fn_wrapper): class VecEnv (line 58) | class VecEnv(object): method __init__ (line 68) | def __init__(self, num_envs, observation_space, action_space): method observe (line 73) | def observe(self, agent): method reset (line 76) | def reset(self): method step_async (line 86) | def step_async(self, actions): method step_wait (line 96) | def step_wait(self): method close (line 108) | def close(self): method step (line 114) | def step(self, actions): method render (line 118) | def render(self, mode='human'): method get_images (line 130) | def get_images(self): method get_viewer (line 136) | def get_viewer(self): method tile_images (line 142) | def tile_images(self, img_nhwc): class CloudpickleWrapper (line 162) | class CloudpickleWrapper(object): method __init__ (line 167) | def __init__(self, x): method __getstate__ (line 170) | def __getstate__(self): method __setstate__ (line 174) | def __setstate__(self, ob): class SubprocVecEnv (line 179) | class SubprocVecEnv(VecEnv): method __init__ (line 180) | def __init__(self, env_fns, spaces=None): method step_async (line 203) | def step_async(self, actions): method step_wait (line 208) | def step_wait(self): method step_wait_2 (line 214) | def step_wait_2(self): method step_wait_3 (line 220) | def step_wait_3(self): method reset (line 226) | def reset(self): method agents (line 231) | def agents(self): method world (line 236) | def world(self): method reset_task (line 241) | def reset_task(self): method spec (line 246) | def spec(self): method get_images (line 251) | def get_images(self): method observe (line 259) | def observe(self, agent): method close (line 267) | def close(self): method __len__ (line 279) | def __len__(self): function _flatten_list (line 282) | def _flatten_list(l): class DummyVecEnv (line 289) | class DummyVecEnv(VecEnv): method __init__ (line 290) | def __init__(self, env_fns): method step_async (line 302) | def step_async(self, actions): method step_wait (line 305) | def step_wait(self): method reset (line 316) | def reset(self): method close (line 320) | def close(self): FILE: examples/Social_Cognition/FOToM/utils/networks.py class MLPNetwork (line 6) | class MLPNetwork(nn.Module): method __init__ (line 10) | def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.relu, method forward (line 39) | def forward(self, X): class RNN (line 51) | class RNN(nn.Module): method __init__ (line 53) | def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.relu, method forward (line 73) | def forward(self, obs, hidden_state): class BCNoSpikingLIFNode (line 81) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 82) | def __init__(self, *args, **kwargs): method forward (line 85) | def forward(self, dv: torch.Tensor): class SNNNetwork (line 89) | class SNNNetwork(nn.Module): method __init__ (line 93) | def __init__(self, input_dim, out_dim, hidden_dim=64, node=LIFNode, ti... method reset (line 127) | def reset(self): method forward (line 132) | def forward(self, X): class LSTMClassifier (line 153) | class LSTMClassifier(nn.Module): method __init__ (line 154) | def __init__(self, input_size, output_size, hidden_size=256): method forward (line 159) | def forward(self, x): FILE: examples/Social_Cognition/FOToM/utils/noise.py class OUNoise (line 5) | class OUNoise: method __init__ (line 6) | def __init__(self, action_dimension, scale=0.1, mu=0, theta=0.15, sigm... method reset (line 15) | def reset(self): method noise (line 18) | def noise(self): FILE: examples/Social_Cognition/Intention_Prediction/Intention_Prediction.py class CustomLinear (line 25) | class CustomLinear(nn.Module): method __init__ (line 26) | def __init__(self, weight,mask=None): method forward (line 31) | def forward(self, x: torch.Tensor): method update (line 36) | def update(self, dw): class DLPFCNet (line 43) | class DLPFCNet(nn.Module): method __init__ (line 44) | def __init__(self,connection): method forward (line 57) | def forward(self, input): method reset (line 73) | def reset(self): method UpdateWeight (line 79) | def UpdateWeight(self, i, W): class OFCNet (line 83) | class OFCNet(nn.Module): method __init__ (line 84) | def __init__(self,connection): method forward (line 105) | def forward(self, Input_Tha, Input_SNc, Reward): method reset (line 120) | def reset(self): class BGNet (line 127) | class BGNet(nn.Module): method __init__ (line 128) | def __init__(self,connection): method forward (line 144) | def forward(self, input1, input2, input3): method reset (line 154) | def reset(self): method UpdateWeight (line 159) | def UpdateWeight(self, i, W): function STDP (line 163) | def STDP(Pre_mat, Post_mat, W): FILE: examples/Social_Cognition/MAToM-SNN/MPE/agents/agents.py class DDPGAgent (line 10) | class DDPGAgent(object): method __init__ (line 15) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, hidden_dim=64, method reset_noise (line 47) | def reset_noise(self): method scale_noise (line 51) | def scale_noise(self, scale): method step (line 57) | def step(self, obs, explore=False): method get_params (line 89) | def get_params(self): method load_params (line 97) | def load_params(self, params): class DDPGAgent_RNN (line 105) | class DDPGAgent_RNN(object): method __init__ (line 110) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, hidden_dim=64, method reset_noise (line 150) | def reset_noise(self): method scale_noise (line 154) | def scale_noise(self, scale): method step (line 160) | def step(self, obs, explore=False): method get_params (line 183) | def get_params(self): method load_params (line 191) | def load_params(self, params): method init_hidden (line 199) | def init_hidden(self, len_ep, policy_hidden=False, policy_target_hidde... class DDPGAgent_SNN (line 211) | class DDPGAgent_SNN(object): method __init__ (line 216) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, output_styl... method reset_noise (line 246) | def reset_noise(self): method scale_noise (line 250) | def scale_noise(self, scale): method step (line 256) | def step(self, obs, explore=False): method get_params (line 297) | def get_params(self): method load_params (line 305) | def load_params(self, params): class DDPGAgent_ToM (line 313) | class DDPGAgent_ToM(object): method __init__ (line 318) | def __init__(self, num_in_pol, num_out_pol, num_in_critic, num_in_mle,... method reset_noise (line 354) | def reset_noise(self): method scale_noise (line 358) | def scale_noise(self, scale): method step (line 364) | def step(self, obs, explore=False): method get_params (line 399) | def get_params(self): method load_params (line 412) | def load_params(self, params): FILE: examples/Social_Cognition/MAToM-SNN/MPE/common/distributions.py class Pd (line 10) | class Pd(object): method flatparam (line 14) | def flatparam(self): method mode (line 16) | def mode(self): method logp (line 18) | def logp(self, x): method kl (line 20) | def kl(self, other): method entropy (line 22) | def entropy(self): method sample (line 24) | def sample(self): class PdType (line 27) | class PdType(object): method pdclass (line 31) | def pdclass(self): method pdfromflat (line 33) | def pdfromflat(self, flat): method param_shape (line 35) | def param_shape(self): method sample_shape (line 37) | def sample_shape(self): method sample_dtype (line 39) | def sample_dtype(self): method param_placeholder (line 42) | def param_placeholder(self, prepend_shape, name=None): method sample_placeholder (line 44) | def sample_placeholder(self, prepend_shape, name=None): class CategoricalPdType (line 47) | class CategoricalPdType(PdType): method __init__ (line 48) | def __init__(self, ncat): method pdclass (line 50) | def pdclass(self): method param_shape (line 52) | def param_shape(self): method sample_shape (line 54) | def sample_shape(self): method sample_dtype (line 56) | def sample_dtype(self): class SoftCategoricalPdType (line 59) | class SoftCategoricalPdType(PdType): method __init__ (line 60) | def __init__(self, ncat): method pdclass (line 62) | def pdclass(self): method param_shape (line 64) | def param_shape(self): method sample_shape (line 66) | def sample_shape(self): method sample_dtype (line 68) | def sample_dtype(self): class MultiCategoricalPdType (line 71) | class MultiCategoricalPdType(PdType): method __init__ (line 72) | def __init__(self, low, high): method pdclass (line 76) | def pdclass(self): method pdfromflat (line 78) | def pdfromflat(self, flat): method param_shape (line 80) | def param_shape(self): method sample_shape (line 82) | def sample_shape(self): method sample_dtype (line 84) | def sample_dtype(self): class SoftMultiCategoricalPdType (line 87) | class SoftMultiCategoricalPdType(PdType): method __init__ (line 88) | def __init__(self, low, high): method pdclass (line 92) | def pdclass(self): method pdfromflat (line 94) | def pdfromflat(self, flat): method param_shape (line 96) | def param_shape(self): method sample_shape (line 98) | def sample_shape(self): method sample_dtype (line 100) | def sample_dtype(self): class DiagGaussianPdType (line 103) | class DiagGaussianPdType(PdType): method __init__ (line 104) | def __init__(self, size): method pdclass (line 106) | def pdclass(self): method param_shape (line 108) | def param_shape(self): method sample_shape (line 110) | def sample_shape(self): method sample_dtype (line 112) | def sample_dtype(self): class BernoulliPdType (line 115) | class BernoulliPdType(PdType): method __init__ (line 116) | def __init__(self, size): method pdclass (line 118) | def pdclass(self): method param_shape (line 120) | def param_shape(self): method sample_shape (line 122) | def sample_shape(self): method sample_dtype (line 124) | def sample_dtype(self): class CategoricalPd (line 150) | class CategoricalPd(Pd): method __init__ (line 151) | def __init__(self, logits): method flatparam (line 153) | def flatparam(self): method mode (line 155) | def mode(self): method logp (line 157) | def logp(self, x): method kl (line 159) | def kl(self, other): method entropy (line 168) | def entropy(self): method sample (line 174) | def sample(self): method fromflat (line 178) | def fromflat(cls, flat): class SoftCategoricalPd (line 181) | class SoftCategoricalPd(Pd): method __init__ (line 182) | def __init__(self, logits): method flatparam (line 184) | def flatparam(self): method mode (line 186) | def mode(self): method logp (line 188) | def logp(self, x): method kl (line 190) | def kl(self, other): method entropy (line 199) | def entropy(self): method sample (line 205) | def sample(self): method fromflat (line 209) | def fromflat(cls, flat): class MultiCategoricalPd (line 212) | class MultiCategoricalPd(Pd): method __init__ (line 213) | def __init__(self, low, high, flat): method flatparam (line 217) | def flatparam(self): method mode (line 219) | def mode(self): method logp (line 221) | def logp(self, x): method kl (line 223) | def kl(self, other): method entropy (line 227) | def entropy(self): method sample (line 229) | def sample(self): method fromflat (line 232) | def fromflat(cls, flat): class SoftMultiCategoricalPd (line 235) | class SoftMultiCategoricalPd(Pd): # doesn't work yet method __init__ (line 236) | def __init__(self, low, high, flat): method flatparam (line 240) | def flatparam(self): method mode (line 242) | def mode(self): method logp (line 247) | def logp(self, x): method kl (line 249) | def kl(self, other): method entropy (line 253) | def entropy(self): method sample (line 255) | def sample(self): method fromflat (line 261) | def fromflat(cls, flat): class DiagGaussianPd (line 264) | class DiagGaussianPd(Pd): method __init__ (line 265) | def __init__(self, flat): method flatparam (line 271) | def flatparam(self): method mode (line 273) | def mode(self): method logp (line 275) | def logp(self, x): method kl (line 279) | def kl(self, other): method entropy (line 282) | def entropy(self): method sample (line 284) | def sample(self): method fromflat (line 287) | def fromflat(cls, flat): class BernoulliPd (line 290) | class BernoulliPd(Pd): method __init__ (line 291) | def __init__(self, logits): method flatparam (line 294) | def flatparam(self): method mode (line 296) | def mode(self): method logp (line 298) | def logp(self, x): method kl (line 300) | def kl(self, other): method entropy (line 302) | def entropy(self): method sample (line 304) | def sample(self): method fromflat (line 309) | def fromflat(cls, flat): function make_pdtype (line 312) | def make_pdtype(ac_space): function shape_el (line 328) | def shape_el(v, i): FILE: examples/Social_Cognition/MAToM-SNN/MPE/common/tile_images.py function tile_images (line 3) | def tile_images(img_nhwc): FILE: examples/Social_Cognition/MAToM-SNN/MPE/common/vec_env/vec_env.py class AlreadySteppingError (line 7) | class AlreadySteppingError(Exception): method __init__ (line 13) | def __init__(self): class NotSteppingError (line 18) | class NotSteppingError(Exception): method __init__ (line 24) | def __init__(self): class VecEnv (line 29) | class VecEnv(ABC): method __init__ (line 43) | def __init__(self, num_envs, observation_space, action_space): method reset (line 49) | def reset(self): method step_async (line 61) | def step_async(self, actions): method step_wait (line 73) | def step_wait(self): method close_extras (line 86) | def close_extras(self): method close (line 93) | def close(self): method step (line 101) | def step(self, actions): method render (line 110) | def render(self, mode='human'): method get_images (line 121) | def get_images(self): method unwrapped (line 128) | def unwrapped(self): method get_viewer (line 134) | def get_viewer(self): class VecEnvWrapper (line 140) | class VecEnvWrapper(VecEnv): method __init__ (line 146) | def __init__(self, venv, observation_space=None, action_space=None): method step_async (line 152) | def step_async(self, actions): method reset (line 156) | def reset(self): method step_wait (line 160) | def step_wait(self): method close (line 163) | def close(self): method render (line 166) | def render(self, mode='human'): method get_images (line 169) | def get_images(self): method __getattr__ (line 172) | def __getattr__(self, name): class VecEnvObservationWrapper (line 177) | class VecEnvObservationWrapper(VecEnvWrapper): method process (line 179) | def process(self, obs): method reset (line 182) | def reset(self): method step_wait (line 186) | def step_wait(self): class CloudpickleWrapper (line 190) | class CloudpickleWrapper(object): method __init__ (line 195) | def __init__(self, x): method __getstate__ (line 198) | def __getstate__(self): method __setstate__ (line 202) | def __setstate__(self, ob): function clear_mpi_env_vars (line 208) | def clear_mpi_env_vars(): FILE: examples/Social_Cognition/MAToM-SNN/MPE/main.py function get_common_args (line 16) | def get_common_args(): function make_parallel_env (line 65) | def make_parallel_env(env_id, n_rollout_threads, seed, discrete_action): function run (line 78) | def run(config): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/__init__.py function load (line 5) | def load(name): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 24) | def reset_world(self, world): method reward (line 41) | def reward(self, agent, world): method observation (line 45) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_crypto.py class CryptoAgent (line 14) | class CryptoAgent(Agent): method __init__ (line 15) | def __init__(self): class Scenario (line 19) | class Scenario(BaseScenario): method make_world (line 21) | def make_world(self): method reset_world (line 47) | def reset_world(self, world): method benchmark_data (line 78) | def benchmark_data(self, agent, world): method good_listeners (line 83) | def good_listeners(self, world): method good_agents (line 87) | def good_agents(self, world): method adversaries (line 91) | def adversaries(self, world): method reward (line 94) | def reward(self, agent, world): method agent_reward (line 97) | def agent_reward(self, agent, world): method adversary_reward (line 116) | def adversary_reward(self, agent, world): method observation (line 124) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_push.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 33) | def reset_world(self, world): method reward (line 58) | def reward(self, agent, world): method agent_reward (line 62) | def agent_reward(self, agent, world): method adversary_reward (line 66) | def adversary_reward(self, agent, world): method observation (line 76) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_reference.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 26) | def reset_world(self, world): method reward (line 55) | def reward(self, agent, world): method observation (line 61) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_speaker_listener.py class Scenario (line 5) | class Scenario(BaseScenario): method make_world (line 6) | def make_world(self): method reset_world (line 33) | def reset_world(self, world): method benchmark_data (line 59) | def benchmark_data(self, agent, world): method reward (line 63) | def reward(self, agent, world): method observation (line 69) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_spread.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self): method reset_world (line 31) | def reset_world(self, world): method benchmark_data (line 47) | def benchmark_data(self, agent, world): method is_collision (line 66) | def is_collision(self, agent1, agent2): method reward (line 72) | def reward(self, agent, world): method observation (line 84) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/multiagent/scenarios/simple_world_comm.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self): method set_boundaries (line 59) | def set_boundaries(self, world): method reset_world (line 88) | def reset_world(self, world): method benchmark_data (line 115) | def benchmark_data(self, agent, world): method is_collision (line 126) | def is_collision(self, agent1, agent2): method good_agents (line 134) | def good_agents(self, world): method adversaries (line 138) | def adversaries(self, world): method reward (line 142) | def reward(self, agent, world): method outside_boundary (line 148) | def outside_boundary(self, agent): method agent_reward (line 155) | def agent_reward(self, agent, world): method adversary_reward (line 185) | def adversary_reward(self, agent, world): method observation2 (line 201) | def observation2(self, agent, world): method observation (line 224) | def observation(self, agent, world): FILE: examples/Social_Cognition/MAToM-SNN/MPE/policy/maddpg.py class MADDPG (line 15) | class MADDPG(object): method __init__ (line 19) | def __init__(self, agent_init_params, alg_types, device, method policies (line 56) | def policies(self): method target_policies (line 60) | def target_policies(self): method scale_noise (line 63) | def scale_noise(self, scale): method reset_noise (line 72) | def reset_noise(self): method step (line 76) | def step(self, observations, explore=False): method update (line 88) | def update(self, sample, agent_i, parallel=False, logger=None): method update_all_targets (line 180) | def update_all_targets(self): method prep_training (line 190) | def prep_training(self, device='gpu'): method prep_rollouts (line 217) | def prep_rollouts(self, device='cpu'): method save (line 230) | def save(self, filename): method init_from_env (line 240) | def init_from_env(cls, env, device, agent_alg="MADDPG", adversary_alg=... method init_from_save (line 292) | def init_from_save(cls, filename): class MADDPG_SNN (line 303) | class MADDPG_SNN(object): method __init__ (line 307) | def __init__(self, agent_init_params, alg_types,output_style, device, method policies (line 344) | def policies(self): method target_policies (line 348) | def target_policies(self): method scale_noise (line 351) | def scale_noise(self, scale): method reset_noise (line 360) | def reset_noise(self): method step (line 364) | def step(self, observations, explore=False): method update (line 376) | def update(self, sample, agent_i, parallel=False, logger=None): method update_all_targets (line 483) | def update_all_targets(self): method prep_training (line 493) | def prep_training(self, device='gpu'): method prep_rollouts (line 520) | def prep_rollouts(self, device='cpu'): method save (line 533) | def save(self, filename): method init_from_env (line 543) | def init_from_env(cls, env, device, agent_alg="MADDPG_SNN", adversary_... method init_from_save (line 598) | def init_from_save(cls, filename): class MADDPG_ToM (line 609) | class MADDPG_ToM(object): method __init__ (line 614) | def __init__(self, agent_init_params, alg_types, output_style, device, method policies (line 699) | def policies(self): method target_policies (line 703) | def target_policies(self): method scale_noise (line 706) | def scale_noise(self, scale): method reset_noise (line 715) | def reset_noise(self): method step (line 719) | def step(self, observations, explore=False): #simple_tag method _get_obs (line 805) | def _get_obs(self, observations): method trian_tag (line 853) | def trian_tag(self, agent_i, KL_criterion, obs, parallel, acs): method trian_adv (line 885) | def trian_adv(self, agent_i, KL_criterion, obs, parallel, acs): method trian_push (line 917) | def trian_push(self, agent_i, KL_criterion, obs, parallel, acs): method trian_com (line 939) | def trian_com(self, agent_i, KL_criterion, obs, parallel, acs): method update (line 964) | def update(self, sample, agent_i, parallel=False, logger=None, sample_... method update_all_targets (line 1067) | def update_all_targets(self): method prep_training (line 1077) | def prep_training(self, device='gpu'): method prep_rollouts (line 1115) | def prep_rollouts(self, device='cpu'): method save (line 1128) | def save(self, filename): method init_from_env (line 1139) | def init_from_env(cls, env, device, agent_alg="MADDPG_ToM", adversary_... method init_from_save (line 1195) | def init_from_save(cls, filename): method get_params (line 1208) | def get_params(self): method load_params (line 1216) | def load_params(self, params): class ToM_SA (line 1221) | class ToM_SA(object): method __init__ (line 1226) | def __init__(self, agent_init_params, alg_types, output_style, device, method policies (line 1311) | def policies(self): method target_policies (line 1315) | def target_policies(self): method scale_noise (line 1318) | def scale_noise(self, scale): method reset_noise (line 1327) | def reset_noise(self): method step (line 1331) | def step(self, observations, actions_pre, explore=False): #simple_tag method _get_obs (line 1442) | def _get_obs(self, observations, actions_pre): method trian_tag (line 1523) | def trian_tag(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_adv (line 1555) | def trian_adv(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_push (line 1587) | def trian_push(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_com (line 1609) | def trian_com(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method update (line 1631) | def update(self, sample, agent_i, parallel=False, logger=None, sample_... method update_all_targets (line 1730) | def update_all_targets(self): method prep_training (line 1740) | def prep_training(self, device='gpu'): method prep_rollouts (line 1778) | def prep_rollouts(self, device='cpu'): method save (line 1791) | def save(self, filename): method init_from_env (line 1802) | def init_from_env(cls, env, device, agent_alg="ToM_SA", adversary_alg=... method init_from_save (line 1858) | def init_from_save(cls, filename): method get_params (line 1871) | def get_params(self): method load_params (line 1879) | def load_params(self, params): class ToM_S (line 1884) | class ToM_S(object): method __init__ (line 1889) | def __init__(self, agent_init_params, alg_types, output_style, device, method policies (line 1974) | def policies(self): method target_policies (line 1978) | def target_policies(self): method scale_noise (line 1981) | def scale_noise(self, scale): method reset_noise (line 1990) | def reset_noise(self): method step (line 1994) | def step(self, observations, actions_pre, explore=False): #simple_tag method _get_obs (line 2100) | def _get_obs(self, observations, actions_pre): method trian_tag (line 2180) | def trian_tag(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_adv (line 2212) | def trian_adv(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_push (line 2244) | def trian_push(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_com (line 2266) | def trian_com(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method update (line 2289) | def update(self, sample, agent_i, parallel=False, logger=None, sample_... method update_all_targets (line 2388) | def update_all_targets(self): method prep_training (line 2398) | def prep_training(self, device='gpu'): method prep_rollouts (line 2436) | def prep_rollouts(self, device='cpu'): method save (line 2449) | def save(self, filename): method init_from_env (line 2460) | def init_from_env(cls, env, device, agent_alg="ToM_S", adversary_alg="... method init_from_save (line 2516) | def init_from_save(cls, filename): method get_params (line 2529) | def get_params(self): method load_params (line 2537) | def load_params(self, params): class ToM_self (line 2542) | class ToM_self(object): method __init__ (line 2547) | def __init__(self, agent_init_params, alg_types, output_style, device, method policies (line 2632) | def policies(self): method target_policies (line 2636) | def target_policies(self): method scale_noise (line 2639) | def scale_noise(self, scale): method reset_noise (line 2648) | def reset_noise(self): method step (line 2652) | def step(self, observations, actions_pre, explore=False): #simple_tag method _get_obs (line 2756) | def _get_obs(self, observations, actions_pre): method trian_tag (line 2840) | def trian_tag(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_adv (line 2862) | def trian_adv(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_push (line 2884) | def trian_push(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method trian_com (line 2896) | def trian_com(self, agent_i, KL_criterion, obs, acs_pre, parallel, acs): method update (line 2918) | def update(self, sample, agent_i, parallel=False, logger=None, sample_... method update_all_targets (line 3017) | def update_all_targets(self): method prep_training (line 3027) | def prep_training(self, device='gpu'): method prep_rollouts (line 3065) | def prep_rollouts(self, device='cpu'): method save (line 3078) | def save(self, filename): method init_from_env (line 3089) | def init_from_env(cls, env, device, agent_alg="ToM_self", adversary_al... method init_from_save (line 3145) | def init_from_save(cls, filename): method get_params (line 3158) | def get_params(self): method load_params (line 3166) | def load_params(self, params): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/buffer.py class ReplayBuffer (line 6) | class ReplayBuffer(object): method __init__ (line 10) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device): method __len__ (line 37) | def __len__(self): method push (line 40) | def push(self, observations, actions, rewards, next_observations, dones): method sample (line 72) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 92) | def get_average_rewards(self, N): class ReplayBuffer_pre (line 99) | class ReplayBuffer_pre(object): method __init__ (line 103) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device): method __len__ (line 132) | def __len__(self): method push (line 135) | def push(self, actions_pre, observations, actions, rewards, next_obser... method sample (line 170) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 191) | def get_average_rewards(self, N): class ReplayBuffer_RNN (line 199) | class ReplayBuffer_RNN(object): method __init__ (line 203) | def __init__(self, max_steps, num_agents, obs_dims, ac_dims, ep_dims): method __len__ (line 230) | def __len__(self): method push (line 233) | def push(self, observations_ep, actions_ep, rewards_ep, next_observati... method sample (line 274) | def sample(self, N, to_gpu=False, norm_rews=True): method get_average_rewards (line 294) | def get_average_rewards(self, N): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/env_wrappers.py function worker (line 9) | def worker(remote, parent_remote, env_fn_wrapper): class SubprocVecEnv (line 40) | class SubprocVecEnv(VecEnv): method __init__ (line 41) | def __init__(self, env_fns, spaces=None): method step_async (line 63) | def step_async(self, actions): method step_wait (line 68) | def step_wait(self): method reset (line 74) | def reset(self): method reset_task (line 79) | def reset_task(self): method close (line 84) | def close(self): class DummyVecEnv (line 97) | class DummyVecEnv(VecEnv): method __init__ (line 98) | def __init__(self, env_fns): method step_async (line 110) | def step_async(self, actions): method step_wait (line 113) | def step_wait(self): method reset (line 124) | def reset(self): method close (line 128) | def close(self): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/make_env.py function make_env (line 15) | def make_env(scenario_name, benchmark=False, discrete_action=False): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/misc.py function soft_update (line 9) | def soft_update(target, source, tau): function hard_update (line 22) | def hard_update(target, source): function average_gradients (line 33) | def average_gradients(model): function init_processes (line 41) | def init_processes(rank, size, fn, backend='gloo'): function onehot_from_logits (line 48) | def onehot_from_logits(logits, eps=0.0): function sample_gumbel (line 65) | def sample_gumbel(shape, eps=1e-20, tens_type=torch.FloatTensor): function gumbel_softmax_sample (line 71) | def gumbel_softmax_sample(logits, temperature): function gumbel_softmax (line 77) | def gumbel_softmax(logits, temperature=1.0, hard=False): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/multiprocessing.py function _flatten_list (line 10) | def _flatten_list(l): function worker (line 18) | def worker(remote, parent_remote, env_fn_wrapper): class VecEnv (line 56) | class VecEnv(object): method __init__ (line 66) | def __init__(self, num_envs, observation_space, action_space): method observe (line 71) | def observe(self, agent): method reset (line 74) | def reset(self): method step_async (line 84) | def step_async(self, actions): method step_wait (line 94) | def step_wait(self): method close (line 106) | def close(self): method step (line 112) | def step(self, actions): method render (line 116) | def render(self, mode='human'): method get_images (line 128) | def get_images(self): method get_viewer (line 134) | def get_viewer(self): method tile_images (line 140) | def tile_images(self, img_nhwc): class CloudpickleWrapper (line 160) | class CloudpickleWrapper(object): method __init__ (line 165) | def __init__(self, x): method __getstate__ (line 168) | def __getstate__(self): method __setstate__ (line 172) | def __setstate__(self, ob): class SubprocVecEnv (line 177) | class SubprocVecEnv(VecEnv): method __init__ (line 178) | def __init__(self, env_fns, spaces=None): method step_async (line 201) | def step_async(self, actions): method step_wait (line 206) | def step_wait(self): method step_wait_2 (line 212) | def step_wait_2(self): method step_wait_3 (line 218) | def step_wait_3(self): method reset (line 224) | def reset(self): method agents (line 229) | def agents(self): method reset_task (line 234) | def reset_task(self): method spec (line 239) | def spec(self): method get_images (line 244) | def get_images(self): method observe (line 252) | def observe(self, agent): method close (line 260) | def close(self): method __len__ (line 272) | def __len__(self): function _flatten_list (line 275) | def _flatten_list(l): class DummyVecEnv (line 282) | class DummyVecEnv(VecEnv): method __init__ (line 283) | def __init__(self, env_fns): method step_async (line 295) | def step_async(self, actions): method step_wait (line 298) | def step_wait(self): method reset (line 309) | def reset(self): method close (line 313) | def close(self): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/networks.py class MLPNetwork (line 7) | class MLPNetwork(nn.Module): method __init__ (line 11) | def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.relu, method forward (line 40) | def forward(self, X): class BCNoSpikingLIFNode (line 53) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 54) | def __init__(self, *args, **kwargs): method forward (line 57) | def forward(self, dv: torch.Tensor): class SNNNetwork (line 61) | class SNNNetwork(nn.Module): method __init__ (line 65) | def __init__(self, input_dim, out_dim, hidden_dim=64, node=LIFNode, ti... method reset (line 99) | def reset(self): method forward (line 104) | def forward(self, X): FILE: examples/Social_Cognition/MAToM-SNN/MPE/utils/noise.py class OUNoise (line 5) | class OUNoise: method __init__ (line 6) | def __init__(self, action_dimension, scale=0.1, mu=0, theta=0.15, sigm... method reset (line 15) | def reset(self): method noise (line 18) | def noise(self): FILE: examples/Social_Cognition/MAToM-SNN/STAG/agents/sagent.py class Agents (line 10) | class Agents: method __init__ (line 11) | def __init__(self, args): method choose_action (line 58) | def choose_action(self, num_env, obs, last_action, agent_num, avail_ac... method _choose_action_from_softmax (line 121) | def _choose_action_from_softmax(self, inputs, avail_actions, epsilon, ... method _get_max_episode_len (line 143) | def _get_max_episode_len(self, batch): method train (line 157) | def train(self, batch, train_step, epsilon=None): # coma needs epsilo... FILE: examples/Social_Cognition/MAToM-SNN/STAG/common_sr/arguments.py function get_common_args (line 3) | def get_common_args(): function get_coma_args (line 52) | def get_coma_args(args): function get_mixer_args (line 80) | def get_mixer_args(args): FILE: examples/Social_Cognition/MAToM-SNN/STAG/common_sr/dummy_vec_env.py class DummyVecEnv (line 5) | class DummyVecEnv(VecEnv): method __init__ (line 12) | def __init__(self, env_fns): method step_async (line 31) | def step_async(self, actions): method step_wait (line 45) | def step_wait(self): method reset (line 58) | def reset(self): method _save_obs (line 64) | def _save_obs(self, e, obs): method _obs_from_buf (line 71) | def _obs_from_buf(self): method get_images (line 74) | def get_images(self): method render (line 77) | def render(self, mode='human'): FILE: examples/Social_Cognition/MAToM-SNN/STAG/common_sr/multiprocessing_env.py function _flatten_list (line 7) | def _flatten_list(l): function worker (line 14) | def worker(remote, parent_remote, env_fn_wrapper): class VecEnv (line 43) | class VecEnv(object): method __init__ (line 47) | def __init__(self, num_envs, observation_space, action_space): method reset (line 52) | def reset(self): method step_async (line 62) | def step_async(self, actions): method step_wait (line 72) | def step_wait(self): method close (line 84) | def close(self): method step (line 90) | def step(self, actions): method render (line 94) | def render(self, mode='human'): method get_images (line 105) | def get_images(self): class CloudpickleWrapper (line 112) | class CloudpickleWrapper(object): method __init__ (line 116) | def __init__(self, x): method __getstate__ (line 118) | def __getstate__(self): method __setstate__ (line 121) | def __setstate__(self, ob): class SubprocVecEnv (line 126) | class SubprocVecEnv(VecEnv): method __init__ (line 127) | def __init__(self, env_fns, spaces=None): method step_async (line 148) | def step_async(self, actions): method step_wait (line 153) | def step_wait(self): method reset (line 159) | def reset(self): method reset_task (line 164) | def reset_task(self): method get_images (line 169) | def get_images(self): method close (line 177) | def close(self): method __len__ (line 189) | def __len__(self): FILE: examples/Social_Cognition/MAToM-SNN/STAG/common_sr/replay_buffer.py class ReplayBuffer (line 5) | class ReplayBuffer: method __init__ (line 6) | def __init__(self, args): method store_episode (line 34) | def store_episode(self, episode_batch): method sample (line 53) | def sample(self, batch_size): method _get_storage_idx (line 60) | def _get_storage_idx(self, inc=None): FILE: examples/Social_Cognition/MAToM-SNN/STAG/common_sr/srollout.py class RolloutWorker (line 4) | class RolloutWorker: method __init__ (line 5) | def __init__(self, env, agents, args): method generate_episode (line 19) | def generate_episode(self, episode_num=None, evaluate=False): method generate_episode_sample (line 154) | def generate_episode_sample(self, episodes, steps, episode_num=None, e... FILE: examples/Social_Cognition/MAToM-SNN/STAG/envs/Stag_Hunt_env.py function env_creator (line 8) | def env_creator(args): FILE: examples/Social_Cognition/MAToM-SNN/STAG/envs/abstract.py class MetaEpisodicEnv (line 12) | class MetaEpisodicEnv(abc.ABC, Generic[ObsType]): method max_episode_len (line 15) | def max_episode_len(self) -> int: method new_env (line 22) | def new_env(self) -> None: method reset (line 34) | def reset(self) -> ObsType: method step (line 46) | def step( FILE: examples/Social_Cognition/MAToM-SNN/STAG/main_spiking.py function make_env (line 56) | def make_env(): FILE: examples/Social_Cognition/MAToM-SNN/STAG/network/spiking_net.py class BCNoSpikingLIFNode (line 18) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 19) | def __init__(self, *args, **kwargs): method forward (line 22) | def forward(self, dv: torch.Tensor): class BCNoSpikingIFNode (line 27) | class BCNoSpikingIFNode(IFNode): method __init__ (line 28) | def __init__(self, *args, **kwargs): method forward (line 31) | def forward(self, dv: torch.Tensor): class ActFun (line 37) | class ActFun(torch.autograd.Function): method forward (line 40) | def forward(ctx, input): method backward (line 45) | def backward(ctx, grad_output): function mem_update (line 55) | def mem_update(fc, x, mem, spike): class Critic (line 62) | class Critic(nn.Module): method __init__ (line 63) | def __init__(self, input_shape, args): method forward (line 72) | def forward(self, inputs, h1_mem, h1_spike, h2_mem, h2_spike): class VDNNet (line 101) | class VDNNet(nn.Module): method __init__ (line 102) | def __init__(self): method forward (line 105) | def forward(self, q_values): class Linear_weight (line 108) | class Linear_weight(nn.Module): method __init__ (line 109) | def __init__(self, input_shape, out_shape, args): method forward (line 115) | def forward(self, x): class BiasNet (line 124) | class BiasNet(nn.Module): method __init__ (line 125) | def __init__(self, args): method reset (line 140) | def reset(self, episode_num): method forward (line 147) | def forward(self, state, hidden): FILE: examples/Social_Cognition/MAToM-SNN/STAG/policy/dqn.py class DQN (line 5) | class DQN: method __init__ (line 6) | def __init__(self, args, model_eval, model_target, agent_id): method learn (line 53) | def learn(self, batch, max_episode_len, train_step, epsilon=None): # ... method _get_inputs (line 116) | def _get_inputs(self, batch, transition_idx): method get_q_values (line 150) | def get_q_values(self, batch, max_episode_len, eval_hidden, target_hid... method init_hidden (line 175) | def init_hidden(self, episode_num, num_env): method init_hidden_learn (line 180) | def init_hidden_learn(self, episode_num): method save_model (line 185) | def save_model(self, train_step): method load_model (line 191) | def load_model(self, train_step): FILE: examples/Social_Cognition/MAToM-SNN/STAG/policy/stomvdn.py class SToMVDN (line 7) | class SToMVDN: method __init__ (line 8) | def __init__(self, args): method learn (line 73) | def learn(self, batch, max_episode_len, train_step, epsilon=None): # ... method _get_inputs (line 163) | def _get_inputs(self, batch, transition_idx): method get_q_values (line 191) | def get_q_values(self, batch, max_episode_len): method get_bias (line 231) | def get_bias(self, batch, hidden_evals, hidden_targets, episode_num, h... method _get_actor_inputs (line 252) | def _get_actor_inputs(self, batch, transition_idx): method _get_action_prob (line 275) | def _get_action_prob(self, batch, max_episode_len, epsilon): method init_hidden (line 320) | def init_hidden(self, episode_num, num_env): method init_hidden_learn (line 331) | def init_hidden_learn(self, episode_num): method save_model (line 342) | def save_model(self, train_step): method load_model (line 349) | def load_model(self, train_step): FILE: examples/Social_Cognition/MAToM-SNN/STAG/policy/svdn.py class SVDN (line 6) | class SVDN: method __init__ (line 7) | def __init__(self, args): method learn (line 58) | def learn(self, batch, max_episode_len, train_step, epsilon=None): # ... method _get_inputs (line 114) | def _get_inputs(self, batch, transition_idx): method get_q_values (line 142) | def get_q_values(self, batch, max_episode_len): method init_hidden (line 171) | def init_hidden(self, episode_num, num_env): method init_hidden_learn (line 182) | def init_hidden_learn(self, episode_num): method save_model (line 193) | def save_model(self, train_step): method load_model (line 199) | def load_model(self, train_step): FILE: examples/Social_Cognition/MAToM-SNN/STAG/preprocessoing/common.py class Preprocessing (line 11) | class Preprocessing(abc.ABC, tc.nn.Module): method forward (line 12) | def forward( function one_hot_torch (line 34) | def one_hot_torch(ys: tc.LongTensor, depth: int, device) -> tc.FloatTensor: function one_hot (line 53) | def one_hot(ys: int, depth: int) -> list: FILE: examples/Social_Cognition/MAToM-SNN/STAG/runner.py class Runner (line 13) | class Runner: method __init__ (line 14) | def __init__(self, env, args): method run (line 32) | def run(self, num): method evaluate (line 73) | def evaluate(self): method plt (line 82) | def plt(self, num): FILE: examples/Social_Cognition/SmashVat/dqn.py class ReplayBuffer (line 22) | class ReplayBuffer: method __init__ (line 23) | def __init__(self, capacity): method push (line 27) | def push(self, *args): method sample (line 32) | def sample(self, batch_size): class AnseEmpDQN (line 37) | class AnseEmpDQN: method __init__ (line 38) | def __init__(self, env, net_type='SNN', method state2tensor (line 69) | def state2tensor(self, state): method epsilon_greedy (line 81) | def epsilon_greedy(self, net, state, epsilon): method train (line 90) | def train(self, lr=1e-3, num_episodes=10000, gamma=0.99, method save (line 244) | def save(self, path): method load (line 249) | def load(self, path): method run (line 252) | def run(self, gif_name=None): function set_seed (line 277) | def set_seed(seed=114514): function main (line 284) | def main(): FILE: examples/Social_Cognition/SmashVat/environment.py class HumanVatGoalEnv (line 10) | class HumanVatGoalEnv(gym.Env): class Actions (line 13) | class Actions(IntEnum): class Cells (line 22) | class Cells(IntEnum): class CellsRender (line 29) | class CellsRender(object): class Params (line 37) | class Params(object): method __init__ (line 40) | def __init__( method __init__ (line 61) | def __init__(self, env_params=Params()): method reset (line 94) | def reset(self): method _gen_map (line 112) | def _gen_map(self): method _gen_obs (line 135) | def _gen_obs(self): method _encode (line 147) | def _encode(self, obs): method _decode (line 155) | def _decode(self, i): method render (line 163) | def render(self, mode="window", cell_size=64, style="realistic"): method _gen_img (line 177) | def _gen_img(self, cell_size, style): method close (line 312) | def close(self): method step (line 318) | def step(self, action): class BasicGoalEnv (line 392) | class BasicGoalEnv(HumanVatGoalEnv): method __init__ (line 393) | def __init__(self): class BasicVatGoalEnv (line 408) | class BasicVatGoalEnv(HumanVatGoalEnv): method __init__ (line 409) | def __init__(self): class BasicHumanVatGoalEnv (line 424) | class BasicHumanVatGoalEnv(HumanVatGoalEnv): method __init__ (line 425) | def __init__(self): class CShapeVatGoalEnv (line 440) | class CShapeVatGoalEnv(HumanVatGoalEnv): method __init__ (line 441) | def __init__(self): class CShapeHumanVatGoalEnv (line 456) | class CShapeHumanVatGoalEnv(HumanVatGoalEnv): method __init__ (line 457) | def __init__(self): class SShapeVatGoalEnv (line 472) | class SShapeVatGoalEnv(HumanVatGoalEnv): method __init__ (line 473) | def __init__(self): class SideHumanVatGoalEnv (line 488) | class SideHumanVatGoalEnv(HumanVatGoalEnv): method __init__ (line 489) | def __init__(self): class SmashAndDetourEnv (line 504) | class SmashAndDetourEnv(HumanVatGoalEnv): method __init__ (line 505) | def __init__(self): class CmpxHumanVatGoalEnv (line 520) | class CmpxHumanVatGoalEnv(HumanVatGoalEnv): method __init__ (line 521) | def __init__(self): FILE: examples/Social_Cognition/SmashVat/main.py function set_seed (line 40) | def set_seed(seed=114514): function save_args (line 47) | def save_args(args, log_dir): function make_dirs (line 54) | def make_dirs(args, timestamp): function main (line 76) | def main(): FILE: examples/Social_Cognition/SmashVat/manual_control.py class ManualControl (line 6) | class ManualControl(object): method __init__ (line 9) | def __init__(self, env=HumanVatGoalEnv()): method display (line 14) | def display(self): method _redraw (line 21) | def _redraw(self): method _reset (line 26) | def _reset(self): method _step (line 39) | def _step(self, action): method _key_handler (line 59) | def _key_handler(self, event): FILE: examples/Social_Cognition/SmashVat/qnets.py class CNNQnet (line 7) | class CNNQnet(nn.Module): method __init__ (line 8) | def __init__(self, input_dim, output_dim): method forward (line 26) | def forward(self, x): class SNNQnet (line 32) | class SNNQnet(nn.Module): method __init__ (line 33) | def __init__(self, input_dim, output_dim, method forward (line 54) | def forward(self, input): method reset (line 65) | def reset(self): FILE: examples/Social_Cognition/SmashVat/side_effect_eval.py class StepwiseInactionModel (line 10) | class StepwiseInactionModel(object): method __init__ (line 13) | def __init__(self, noop_action=None): method reset (line 19) | def reset(self, baseline_state): method _sample (line 23) | def _sample(self, state): method calculate (line 31) | def calculate(self, prev_state, prev_action, current_state): class AttainableUtilityMeasure (line 44) | class AttainableUtilityMeasure(object): method __init__ (line 45) | def __init__(self, uf_num=10, uf_discount=0.99): method update (line 63) | def update(self, prev_state, prev_action, current_state): method calculate (line 84) | def calculate(self, current_state, baseline_state, dev_fun=lambda diff... method _get_aup_value (line 98) | def _get_aup_value(self, state): method _get_avgd_confid (line 116) | def _get_avgd_confid(self, state): method _get_u_values (line 121) | def _get_u_values(self, state): FILE: examples/Social_Cognition/SmashVat/window.py class Window (line 9) | class Window(object): method __init__ (line 12) | def __init__(self, title): method set_window_title (line 27) | def set_window_title(self, title): method reg_key_press_handler (line 33) | def reg_key_press_handler(self, key_press_handler): method _default_key_press_handler (line 38) | def _default_key_press_handler(self, event): method show (line 44) | def show(self, block=True): method show_img (line 72) | def show_img(self, img): method close (line 87) | def close(self): method is_open (line 91) | def is_open(self): function on_press (line 100) | def on_press(event): FILE: examples/Social_Cognition/ToCM/agent/controllers/ToCMController.py class ToCMController (line 12) | class ToCMController: method __init__ (line 14) | def __init__(self, config): method receive_params (line 28) | def receive_params(self, params): method init_buffer (line 32) | def init_buffer(self): method init_rnns (line 35) | def init_rnns(self): method dispatch_buffer (line 39) | def dispatch_buffer(self): method update_buffer (line 48) | def update_buffer(self, items): method step (line 54) | def step(self, observations, avail_actions, nn_mask): method advance_rnns (line 86) | def advance_rnns(self, state): method exploration (line 89) | def exploration(self, action): FILE: examples/Social_Cognition/ToCM/agent/learners/ToCMLearner.py function orthogonal_init (line 17) | def orthogonal_init(tensor, gain=1): function initialize_weights (line 39) | def initialize_weights(mod, scale=1.0, mode='ortho'): class ToCMLearner (line 49) | class ToCMLearner: # 通过ToCMLearnerConfig来构建 method __init__ (line 51) | def __init__(self, config): method init_optimizers (line 112) | def init_optimizers(self): method params (line 118) | def params(self): method step (line 123) | def step(self, rollout): method train_model (line 157) | def train_model(self, samples): # world model method train_agent (line 167) | def train_agent(self, samples): method apply_optimizer (line 203) | def apply_optimizer(self, opt, model, loss, grad_clip, name=None): # ... method apply_optimizer_scheduler (line 211) | def apply_optimizer_scheduler(self, opt, sch, model, loss, grad_clip, ... FILE: examples/Social_Cognition/ToCM/agent/memory/ToCMMemory.py class ToCMMemory (line 8) | class ToCMMemory: method __init__ (line 9) | def __init__(self, capacity, sequence_length, action_size, obs_size, n... method init_buffer (line 18) | def init_buffer(self, n_agents, env_type): # 初始对环境进行采样,观察和动作都是np.arra... method append (line 31) | def append(self, obs, action, reward, done, fake, last, av_action): method tenzorify (line 46) | def tenzorify(self, nparray): method sample (line 49) | def sample(self, batch_size): method process_batch (line 52) | def process_batch(self, val, idxs, batch_size): # 这里全部传到了cuda上 method get_transitions (line 55) | def get_transitions(self, idxs): method sample_position (line 69) | def sample_position(self): method sample_positions (line 77) | def sample_positions(self, batch_size): method __len__ (line 80) | def __len__(self): method clean (line 83) | def clean(self): FILE: examples/Social_Cognition/ToCM/agent/models/ToCMModel.py class ToCMModel (line 12) | class ToCMModel(nn.Module): method __init__ (line 13) | def __init__(self, config): method forward (line 40) | def forward(self, observations, prev_actions=None, prev_states=None, m... method get_state_representation (line 51) | def get_state_representation(self, observations, prev_actions, prev_st... FILE: examples/Social_Cognition/ToCM/agent/optim/loss.py function model_loss (line 12) | def model_loss(config, model, obs, action, av_action, reward, done, fake... function actor_rollout (line 47) | def actor_rollout(obs, action, last, model, actor, critic, config): # m... function critic_rollout (line 77) | def critic_rollout(model, critic, states, rew_states, actions, raw_state... function calculate_reward (line 94) | def calculate_reward(model, states, mask=None): function calculate_next_reward (line 101) | def calculate_next_reward(model, actions, states): function actor_loss (line 108) | def actor_loss(model, imag_state, obs_pred, actions, av_actions, old_pol... function value_loss (line 124) | def value_loss(critic, actions, imag_feat, targets): FILE: examples/Social_Cognition/ToCM/agent/optim/utils.py function rec_loss (line 7) | def rec_loss(decoder, z, x, fake): function ppo_loss (line 14) | def ppo_loss(A, rho, eps=0.2): function mse (line 18) | def mse(model, x, target): function entropy_loss (line 23) | def entropy_loss(prob, logProb): function advantage (line 27) | def advantage(A): function calculate_ppo_loss (line 35) | def calculate_ppo_loss(logits, rho, A): # pi rho adv function batch_multi_agent (line 43) | def batch_multi_agent(tensor, n_agents): function compute_return (line 51) | def compute_return(reward, value, discount, bootstrap, lmbda, gamma): function info_loss (line 64) | def info_loss(feat, model, actions, fake): function action_information_loss (line 70) | def action_information_loss(logits, target): function log_prob_loss (line 75) | def log_prob_loss(model, x, target): function kl_div_categorical (line 80) | def kl_div_categorical(p, q): function reshape_dist (line 85) | def reshape_dist(dist, config): function state_divergence_loss (line 89) | def state_divergence_loss(prior, posterior, config, reduce=True, balance... FILE: examples/Social_Cognition/ToCM/agent/runners/ToCMRunner.py class ToCMServer (line 9) | class ToCMServer: method __init__ (line 10) | def __init__(self, n_workers, env_config, controller_config, model): method append (line 17) | def append(self, idx, update): method run (line 20) | def run(self): class ToCMRunner (line 28) | class ToCMRunner: method __init__ (line 30) | def __init__(self, env_config, learner_config, controller_config, n_wo... method run (line 42) | def run(self, max_steps=10 ** 10, max_episodes=10 ** 10): # 10**10 50000 FILE: examples/Social_Cognition/ToCM/agent/utils/params.py function get_parameters (line 5) | def get_parameters(modules: Iterable[Module]): class FreezeParameters (line 17) | class FreezeParameters: method __init__ (line 18) | def __init__(self, modules: Iterable[Module]): method __enter__ (line 32) | def __enter__(self): method __exit__ (line 36) | def __exit__(self, exc_type, exc_val, exc_tb): FILE: examples/Social_Cognition/ToCM/agent/workers/ToCMWorker.py class ToCMWorker (line 11) | class ToCMWorker: method __init__ (line 13) | def __init__(self, idx, env_config, controller_config): method _check_handle (line 22) | def _check_handle(self, handle): method _select_actions (line 29) | def _select_actions(self, state): method _wrap (line 62) | def _wrap(self, d): method get_absorbing_state (line 67) | def get_absorbing_state(self): method augment (line 71) | def augment(self, data, inverse=False): method _check_termination (line 81) | def _check_termination(self, info, steps_done): method run (line 87) | def run(self, ToCM_params): FILE: examples/Social_Cognition/ToCM/configs/Config.py class Config (line 5) | class Config: method __init__ (line 6) | def __init__(self): method to_dict (line 9) | def to_dict(self, prefix=""): FILE: examples/Social_Cognition/ToCM/configs/EnvConfigs.py class EnvConfig (line 6) | class EnvConfig(Config): method __init__ (line 7) | def __init__(self): method create_env (line 10) | def create_env(self): class MPEConfig (line 15) | class MPEConfig(EnvConfig): method __init__ (line 16) | def __init__(self, args): method create_env (line 19) | def create_env(self): class StarCraftConfig (line 23) | class StarCraftConfig(EnvConfig): method __init__ (line 24) | def __init__(self, env_name, random_seed): method create_env (line 28) | def create_env(self): class EnvCurriculumConfig (line 32) | class EnvCurriculumConfig(EnvConfig): method __init__ (line 33) | def __init__(self, env_configs, env_episodes, env_type, device, obs_bu... method update_random_seed (line 45) | def update_random_seed(self): method set_obs_builder_config (line 49) | def set_obs_builder_config(self, obs_builder_config): method set_reward_config (line 53) | def set_reward_config(self, reward_config): method create_env (line 57) | def create_env(self): class EnvCurriculumSampleConfig (line 61) | class EnvCurriculumSampleConfig(EnvConfig): method __init__ (line 62) | def __init__(self, env_configs, env_probs, obs_builder_config=None, re... method update_random_seed (line 72) | def update_random_seed(self): method set_obs_builder_config (line 76) | def set_obs_builder_config(self, obs_builder_config): method set_reward_config (line 80) | def set_reward_config(self, reward_config): method create_env (line 84) | def create_env(self): class EnvCurriculumPrioritizedSampleConfig (line 88) | class EnvCurriculumPrioritizedSampleConfig(EnvConfig): method __init__ (line 89) | def __init__(self, env_configs, repeat_random_seed, obs_builder_config... method update_random_seed (line 99) | def update_random_seed(self): method set_obs_builder_config (line 103) | def set_obs_builder_config(self, obs_builder_config): method set_reward_config (line 107) | def set_reward_config(self, reward_config): method create_env (line 111) | def create_env(self): FILE: examples/Social_Cognition/ToCM/configs/Experiment.py class Experiment (line 4) | class Experiment(Config): # 这个还没改且里面没有 method __init__ (line 5) | def __init__(self, steps, episodes, random_seed, env_config, controlle... FILE: examples/Social_Cognition/ToCM/configs/ToCM/ToCMAgentConfig.py class ToCMConfig (line 13) | class ToCMConfig(Config): # 从Config继承 method __init__ (line 14) | def __init__(self): class RSSMStateBase (line 43) | class RSSMStateBase: method map (line 47) | def map(self, func): method get_features (line 50) | def get_features(self): method get_dist (line 53) | def get_dist(self, *input): method type (line 56) | def type(self): class RSSMStateDiscrete (line 61) | class RSSMStateDiscrete(RSSMStateBase): method get_dist (line 64) | def get_dist(self, batch_shape, n_categoricals, n_classes): class RSSMStateCont (line 69) | class RSSMStateCont(RSSMStateBase): method get_dist (line 73) | def get_dist(self, *input): FILE: examples/Social_Cognition/ToCM/configs/ToCM/ToCMControllerConfig.py class ToCMControllerConfig (line 6) | class ToCMControllerConfig(ToCMConfig): method __init__ (line 7) | def __init__(self, env_name, RANDOM_SEED, device): # RANDOM_SEED:23 d... method create_controller (line 17) | def create_controller(self): FILE: examples/Social_Cognition/ToCM/configs/ToCM/ToCMLearnerConfig.py class ToCMLearnerConfig (line 6) | class ToCMLearnerConfig(ToCMConfig): # 从ToCMConfig继承,有输入维度、输出维度、隐层维度、隐层... method __init__ (line 7) | def __init__(self, env_name, RANDOM_SEED, device): method create_learner (line 32) | def create_learner(self): # 通过config创建learner FILE: examples/Social_Cognition/ToCM/configs/ToCM/optimal/starcraft/AgentConfig.py class ToCMConfig (line 4) | class ToCMConfig(Config): method __init__ (line 5) | def __init__(self): FILE: examples/Social_Cognition/ToCM/configs/ToCM/optimal/starcraft/LearnerConfig.py class ToCMLearnerConfig (line 5) | class ToCMLearnerConfig(ToCMConfig): method __init__ (line 6) | def __init__(self): method create_learner (line 28) | def create_learner(self): FILE: examples/Social_Cognition/ToCM/env/mpe/MPE.py class MPE (line 4) | class MPE: method __init__ (line 6) | def __init__(self, args): method to_dict (line 15) | def to_dict(self, l): method step (line 18) | def step(self, action_dict): # action dict for each agent method reset (line 24) | def reset(self): method close (line 28) | def close(self): method get_avail_agent_actions (line 32) | def get_avail_agent_actions(self, handle): # available handle is the ... FILE: examples/Social_Cognition/ToCM/env/starcraft/StarCraft.py class StarCraft (line 4) | class StarCraft: method __init__ (line 6) | def __init__(self, env_name, random_seed): method to_dict (line 15) | def to_dict(self, l): method step (line 18) | def step(self, action_dict): method reset (line 23) | def reset(self): method render (line 27) | def render(self): method close (line 30) | def close(self): method get_avail_agent_actions (line 33) | def get_avail_agent_actions(self, handle): FILE: examples/Social_Cognition/ToCM/environments.py class Env (line 4) | class Env(str, Enum): FILE: examples/Social_Cognition/ToCM/mpe/MPE_Env.py function MPEEnv (line 18) | def MPEEnv(args): FILE: examples/Social_Cognition/ToCM/mpe/core.py class EntityState (line 5) | class EntityState(object): method __init__ (line 6) | def __init__(self): class AgentState (line 13) | class AgentState(EntityState): method __init__ (line 14) | def __init__(self): class Action (line 20) | class Action(object): method __init__ (line 21) | def __init__(self): class Wall (line 28) | class Wall(object): method __init__ (line 29) | def __init__(self, orient='H', axis_pos=0.0, endpoints=(-1, 1), width=... class Entity (line 46) | class Entity(object): method __init__ (line 47) | def __init__(self): method mass (line 75) | def mass(self): class Landmark (line 79) | class Landmark(Entity): method __init__ (line 80) | def __init__(self): class Agent (line 84) | class Agent(Entity): method __init__ (line 85) | def __init__(self): class World (line 113) | class World(object): method __init__ (line 114) | def __init__(self): method entities (line 144) | def entities(self): method policy_agents (line 149) | def policy_agents(self): method scripted_agents (line 154) | def scripted_agents(self): method calculate_distances (line 157) | def calculate_distances(self): method assign_agent_colors (line 183) | def assign_agent_colors(self): method assign_landmark_colors (line 202) | def assign_landmark_colors(self): method step (line 207) | def step(self): method apply_action_force (line 228) | def apply_action_force(self, p_force): method apply_environment_force (line 240) | def apply_environment_force(self, p_force): method integrate_state (line 265) | def integrate_state(self, p_force): method update_agent_state (line 280) | def update_agent_state(self, agent): method get_entity_collision_force (line 290) | def get_entity_collision_force(self, ia, ib): method get_wall_collision_force (line 324) | def get_wall_collision_force(self, entity, wall): FILE: examples/Social_Cognition/ToCM/mpe/environment.py class MultiAgentEnv (line 15) | class MultiAgentEnv(gym.Env): method __init__ (line 20) | def __init__(self, world, reset_callback=None, reward_callback=None, method seed (line 110) | def seed(self, seed=None): method step (line 117) | def step(self, action_n): method reset (line 148) | def reset(self): method _get_info (line 164) | def _get_info(self, agent): method _get_obs (line 170) | def _get_obs(self, agent): method _get_done (line 180) | def _get_done(self, agent): method _get_reward (line 191) | def _get_reward(self, agent): method _set_action (line 197) | def _set_action(self, action, agent, action_space, time=None): method _get_avail_action (line 261) | def _get_avail_action(self, handle): method _reset_render (line 265) | def _reset_render(self): method render (line 269) | def render(self, mode='human', close=True): method _make_receptor_locations (line 421) | def _make_receptor_locations(self, agent): FILE: examples/Social_Cognition/ToCM/mpe/multi_discrete.py class MultiDiscrete (line 9) | class MultiDiscrete(gym.Space): method __init__ (line 26) | def __init__(self, array_of_param_array): method sample (line 31) | def sample(self): method contains (line 39) | def contains(self, x): method shape (line 43) | def shape(self): method __repr__ (line 46) | def __repr__(self): method __eq__ (line 49) | def __eq__(self, other): FILE: examples/Social_Cognition/ToCM/mpe/rendering.py function get_display (line 35) | def get_display(spec): class Viewer (line 50) | class Viewer(object): method __init__ (line 51) | def __init__(self, width, height, display=None): method close (line 72) | def close(self): method window_closed_by_user (line 75) | def window_closed_by_user(self): method set_bounds (line 78) | def set_bounds(self, left, right, bottom, top): method add_geom (line 86) | def add_geom(self, geom): method add_onetime (line 89) | def add_onetime(self, geom): method render (line 92) | def render(self, return_rgb_array=False): method draw_circle (line 121) | def draw_circle(self, radius=10, res=30, filled=True, **attrs): method draw_polygon (line 127) | def draw_polygon(self, v, filled=True, **attrs): method draw_polyline (line 133) | def draw_polyline(self, v, **attrs): method draw_line (line 139) | def draw_line(self, start, end, **attrs): method get_array (line 145) | def get_array(self): function _add_attrs (line 154) | def _add_attrs(geom, attrs): class Geom (line 161) | class Geom(object): method __init__ (line 162) | def __init__(self): method render (line 166) | def render(self): method render1 (line 173) | def render1(self): method add_attr (line 176) | def add_attr(self, attr): method set_color (line 179) | def set_color(self, r, g, b, alpha=1): class Attr (line 183) | class Attr(object): method enable (line 184) | def enable(self): method disable (line 187) | def disable(self): class Transform (line 191) | class Transform(Attr): method __init__ (line 192) | def __init__(self, translation=(0.0, 0.0), rotation=0.0, scale=(1, 1)): method enable (line 197) | def enable(self): method disable (line 204) | def disable(self): method set_translation (line 207) | def set_translation(self, newx, newy): method set_rotation (line 210) | def set_rotation(self, new): method set_scale (line 213) | def set_scale(self, newx, newy): class Color (line 217) | class Color(Attr): method __init__ (line 218) | def __init__(self, vec4): method enable (line 221) | def enable(self): class LineStyle (line 225) | class LineStyle(Attr): method __init__ (line 226) | def __init__(self, style): method enable (line 229) | def enable(self): method disable (line 233) | def disable(self): class LineWidth (line 237) | class LineWidth(Attr): method __init__ (line 238) | def __init__(self, stroke): method enable (line 241) | def enable(self): class Point (line 245) | class Point(Geom): method __init__ (line 246) | def __init__(self): method render1 (line 249) | def render1(self): class FilledPolygon (line 255) | class FilledPolygon(Geom): method __init__ (line 256) | def __init__(self, v): method render1 (line 260) | def render1(self): function make_circle (line 280) | def make_circle(radius=10, res=30, filled=True): function make_polygon (line 291) | def make_polygon(v, filled=True): function make_polyline (line 298) | def make_polyline(v): function make_capsule (line 302) | def make_capsule(length, width): class Compound (line 312) | class Compound(Geom): method __init__ (line 313) | def __init__(self, gs): method render1 (line 319) | def render1(self): class PolyLine (line 324) | class PolyLine(Geom): method __init__ (line 325) | def __init__(self, v, close): method render1 (line 332) | def render1(self): method set_linewidth (line 338) | def set_linewidth(self, x): class Line (line 342) | class Line(Geom): method __init__ (line 343) | def __init__(self, start=(0.0, 0.0), end=(0.0, 0.0)): method render1 (line 350) | def render1(self): class Image (line 357) | class Image(Geom): method __init__ (line 358) | def __init__(self, fname, width, height): method render1 (line 366) | def render1(self): class SimpleImageViewer (line 373) | class SimpleImageViewer(object): method __init__ (line 374) | def __init__(self, display=None): method imshow (line 379) | def imshow(self, arr): method close (line 397) | def close(self): method __del__ (line 402) | def __del__(self): FILE: examples/Social_Cognition/ToCM/mpe/scenario.py class BaseScenario (line 5) | class BaseScenario(object): method make_world (line 7) | def make_world(self): method reset_world (line 11) | def reset_world(self, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/__init__.py function load (line 4) | def load(name): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/hetero_spread.py class Scenario (line 7) | class Scenario(BaseScenario): method make_world (line 8) | def make_world(self, args): method reset_world (line 47) | def reset_world(self, world): method benchmark_data (line 68) | def benchmark_data(self, agent, world): method is_collision (line 87) | def is_collision(self, agent1, agent2): method reward (line 93) | def reward(self, agent, world): method observation (line 127) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_adversary.py class Scenario (line 7) | class Scenario(BaseScenario): method make_world (line 9) | def make_world(self, args): method reset_world (line 36) | def reset_world(self, world): method benchmark_data (line 55) | def benchmark_data(self, agent, world): method good_agents (line 67) | def good_agents(self, world): method adversaries (line 71) | def adversaries(self, world): method reward (line 74) | def reward(self, agent, world): method agent_reward (line 78) | def agent_reward(self, agent, world): method adversary_reward (line 107) | def adversary_reward(self, agent, world): method observation (line 119) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_crypto.py class CryptoAgent (line 13) | class CryptoAgent(Agent): method __init__ (line 14) | def __init__(self): class Scenario (line 19) | class Scenario(BaseScenario): method make_world (line 21) | def make_world(self, args): method reset_world (line 46) | def reset_world(self, world): method benchmark_data (line 76) | def benchmark_data(self, agent, world): method good_listeners (line 81) | def good_listeners(self, world): method good_agents (line 85) | def good_agents(self, world): method adversaries (line 89) | def adversaries(self, world): method reward (line 92) | def reward(self, agent, world): method agent_reward (line 95) | def agent_reward(self, agent, world): method adversary_reward (line 114) | def adversary_reward(self, agent, world): method observation (line 121) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_crypto_display.py class CryptoAgent (line 13) | class CryptoAgent(Agent): method __init__ (line 14) | def __init__(self): class Scenario (line 19) | class Scenario(BaseScenario): method make_world (line 21) | def make_world(self, args): method reset_world (line 46) | def reset_world(self, world): method benchmark_data (line 82) | def benchmark_data(self, agent, world): method good_listeners (line 87) | def good_listeners(self, world): method good_agents (line 91) | def good_agents(self, world): method adversaries (line 95) | def adversaries(self, world): method reward (line 98) | def reward(self, agent, world): method agent_reward (line 101) | def agent_reward(self, agent, world): method adversary_reward (line 120) | def adversary_reward(self, agent, world): method observation (line 127) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_push.py class Scenario (line 12) | class Scenario(BaseScenario): method make_world (line 13) | def make_world(self, args): method reset_world (line 42) | def reset_world(self, world): method reward (line 67) | def reward(self, agent, world): method agent_reward (line 71) | def agent_reward(self, agent, world): method adversary_reward (line 75) | def adversary_reward(self, agent, world): method observation (line 86) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_reference.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, args): method reset_world (line 34) | def reset_world(self, world): method reward (line 62) | def reward(self, agent, world): method observation (line 69) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_speaker_listener.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, args): method reset_world (line 38) | def reset_world(self, world): method benchmark_data (line 65) | def benchmark_data(self, agent, world): method reward (line 69) | def reward(self, agent, world): method observation (line 75) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_spread.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, args): method reset_world (line 32) | def reset_world(self, world): method benchmark_data (line 47) | def benchmark_data(self, agent, world): method is_collision (line 66) | def is_collision(self, agent1, agent2): method reward (line 72) | def reward(self, agent, world): method observation (line 86) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_tag.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, args): method reset_world (line 38) | def reset_world(self, world): method benchmark_data (line 54) | def benchmark_data(self, agent, world): method is_collision (line 65) | def is_collision(self, agent1, agent2): method good_agents (line 72) | def good_agents(self, world): method adversaries (line 76) | def adversaries(self, world): method reward (line 79) | def reward(self, agent, world): method agent_reward (line 84) | def agent_reward(self, agent, world): method adversary_reward (line 111) | def adversary_reward(self, agent, world): method observation (line 127) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/mpe/scenarios/simple_world_comm.py class Scenario (line 6) | class Scenario(BaseScenario): method make_world (line 7) | def make_world(self, args): method set_boundaries (line 59) | def set_boundaries(self, world): method reset_world (line 87) | def reset_world(self, world): method benchmark_data (line 114) | def benchmark_data(self, agent, world): method is_collision (line 124) | def is_collision(self, agent1, agent2): method good_agents (line 131) | def good_agents(self, world): method adversaries (line 135) | def adversaries(self, world): method reward (line 138) | def reward(self, agent, world): method outside_boundary (line 144) | def outside_boundary(self, agent): method agent_reward (line 151) | def agent_reward(self, agent, world): method adversary_reward (line 182) | def adversary_reward(self, agent, world): method observation2 (line 199) | def observation2(self, agent, world): method observation (line 222) | def observation(self, agent, world): FILE: examples/Social_Cognition/ToCM/networks/ToCM/action.py class BCNoSpikingLIFNode (line 20) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 21) | def __init__(self, *args, **kwargs): method forward (line 24) | def forward(self, dv: torch.Tensor): class Actor (line 72) | class Actor(nn.Module): method __init__ (line 73) | def __init__(self, in_dim, out_dim, hidden_size, layers, activation=nn... method forward (line 78) | def forward(self, state_features): class AttentionActor (line 84) | class AttentionActor(nn.Module): method __init__ (line 85) | def __init__(self, in_dim, out_dim, hidden_size, layers, node='LIFNode... method forward (line 119) | def forward(self, state_features): # 状态值tensor method reset (line 153) | def reset(self): FILE: examples/Social_Cognition/ToCM/networks/ToCM/critic.py class BCNoSpikingLIFNode (line 19) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 20) | def __init__(self, *args, **kwargs): method forward (line 23) | def forward(self, dv: torch.Tensor): function mem_update (line 33) | def mem_update(fc, x, mem, spike): class Critic (line 40) | class Critic(nn.Module): method __init__ (line 41) | def __init__(self, in_dim, hidden_size, layers=2, node='LIFNode', time... method forward (line 79) | def forward(self, state_features, actions): method reset (line 99) | def reset(self): class MADDPGCritic (line 176) | class MADDPGCritic(nn.Module): method __init__ (line 177) | def __init__(self, in_dim, hidden_size, layers=2, activation=nn.ELU): method forward (line 184) | def forward(self, state_features, actions): FILE: examples/Social_Cognition/ToCM/networks/ToCM/dense.py class DenseModel (line 8) | class DenseModel(nn.Module): method __init__ (line 9) | def __init__(self, in_dim, out_dim, layers, hidden, activation="nn.ELU... method forward (line 14) | def forward(self, features): class DenseBinaryModel (line 18) | class DenseBinaryModel(DenseModel): method __init__ (line 19) | def __init__(self, in_dim, out_dim, layers, hidden, activation="nn.ELU... method forward (line 22) | def forward(self, features): FILE: examples/Social_Cognition/ToCM/networks/ToCM/rnns.py function stack_states (line 9) | def stack_states(rssm_states: list, dim): function cat_states (line 13) | def cat_states(rssm_states: list, dim): function reduce_states (line 17) | def reduce_states(rssm_states: list, dim, func): class DiscreteLatentDist (line 22) | class DiscreteLatentDist(nn.Module): method __init__ (line 23) | def __init__(self, in_dim, n_categoricals, n_classes, hidden_size): method forward (line 31) | def forward(self, x): class RSSMTransition (line 39) | class RSSMTransition(nn.Module): method __init__ (line 40) | def __init__(self, config, hidden_size=200, activation=nn.ReLU): method _build_rnn_input_model (line 52) | def _build_rnn_input_model(self, in_dim): method forward (line 57) | def forward(self, prev_actions, prev_states, mask=None): class RSSMRepresentation (line 68) | class RSSMRepresentation(nn.Module): method __init__ (line 69) | def __init__(self, config, transition_model: RSSMTransition): method initial_state (line 77) | def initial_state(self, batch_size, n_agents, **kwargs): method forward (line 82) | def forward(self, obs_embed, prev_actions, prev_states, mask=None): function rollout_representation (line 96) | def rollout_representation(representation_model, steps, obs_embed, actio... function rollout_policy (line 118) | def rollout_policy(transition_model, av_action, steps, policy, prev_stat... FILE: examples/Social_Cognition/ToCM/networks/ToCM/utils.py class AtanLIFNode (line 9) | class AtanLIFNode(LIFNode): method __init__ (line 10) | def __init__(self, tau=0.5, *args, **kwargs): class BCNoSpikingLIFNode (line 15) | class BCNoSpikingLIFNode(LIFNode): method __init__ (line 16) | def __init__(self, tau, *args, **kwargs): method forward (line 20) | def forward(self, dv: torch.Tensor): function build_model_snn (line 27) | def build_model_snn(in_dim, out_dim, layers, hidden, th=0.5, re=0.0, tau... function build_model (line 57) | def build_model(in_dim, out_dim, layers, hidden, activation, normalize=l... FILE: examples/Social_Cognition/ToCM/networks/ToCM/vae.py class Decoder (line 7) | class Decoder(nn.Module): method __init__ (line 9) | def __init__(self, embed, hidden, out_dim, layers=2): method forward (line 14) | def forward(self, z): class Encoder (line 19) | class Encoder(nn.Module): method __init__ (line 21) | def __init__(self, in_dim, hidden, embed, layers=2): method forward (line 27) | def forward(self, x): FILE: examples/Social_Cognition/ToCM/networks/transformer/layers.py class PositionalEncoding (line 7) | class PositionalEncoding(nn.Module): method __init__ (line 10) | def __init__(self, d_hid, n_position=2): method _get_sinusoid_encoding_table (line 24) | def _get_sinusoid_encoding_table(n_position, d_hid): method forward (line 37) | def forward(self, x): class AttentionEncoder (line 41) | class AttentionEncoder(nn.Module): method __init__ (line 43) | def __init__(self, n_layers, in_dim, hidden, dropout=0.): method forward (line 50) | def forward(self, enc_input, **kwargs): class AttentionActorEncoder (line 56) | class AttentionActorEncoder(nn.Module): method __init__ (line 58) | def __init__(self, n_layers, in_dim, hidden, dropout=0.): method forward (line 64) | def forward(self, enc_input, **kwargs): FILE: examples/Social_Cognition/ToCM/smac/bin/map_list.py function main (line 10) | def main(): FILE: examples/Social_Cognition/ToCM/smac/env/multiagentenv.py class MultiAgentEnv (line 6) | class MultiAgentEnv(object): method step (line 7) | def step(self, actions): method get_obs (line 11) | def get_obs(self): method get_obs_agent (line 15) | def get_obs_agent(self, agent_id): method get_obs_size (line 19) | def get_obs_size(self): method get_state (line 23) | def get_state(self): method get_state_size (line 27) | def get_state_size(self): method get_avail_actions (line 31) | def get_avail_actions(self): method get_avail_agent_actions (line 35) | def get_avail_agent_actions(self, agent_id): method get_total_actions (line 39) | def get_total_actions(self): method reset (line 43) | def reset(self): method render (line 47) | def render(self): method close (line 50) | def close(self): method seed (line 53) | def seed(self): method save_replay (line 56) | def save_replay(self): method get_env_info (line 60) | def get_env_info(self): FILE: examples/Social_Cognition/ToCM/smac/env/pettingzoo/StarCraft2PZEnv.py function parallel_env (line 13) | def parallel_env(max_cycles=max_cycles_default, **smac_args): function raw_env (line 17) | def raw_env(max_cycles=max_cycles_default, **smac_args): function make_env (line 21) | def make_env(raw_env): class smac_parallel_env (line 32) | class smac_parallel_env(ParallelEnv): method __init__ (line 33) | def __init__(self, env, max_cycles): method _init_agents (line 63) | def _init_agents(self): method seed (line 106) | def seed(self, seed=None): method render (line 113) | def render(self, mode="human"): method close (line 116) | def close(self): method reset (line 119) | def reset(self): method get_agent_smac_id (line 128) | def get_agent_smac_id(self, agent): method _all_rewards (line 131) | def _all_rewards(self, reward): method _observe_all (line 137) | def _observe_all(self): method _all_dones (line 151) | def _all_dones(self, step_done=False): method step (line 163) | def step(self, all_actions): method __del__ (line 188) | def __del__(self): class _parallel_env (line 195) | class _parallel_env(smac_parallel_env, EzPickle): method __init__ (line 198) | def __init__(self, max_cycles, **smac_args): FILE: examples/Social_Cognition/ToCM/smac/env/pettingzoo/test/all_test.py function test_env (line 18) | def test_env(map_name): FILE: examples/Social_Cognition/ToCM/smac/env/starcraft2/maps/__init__.py function get_map_params (line 8) | def get_map_params(map_name): FILE: examples/Social_Cognition/ToCM/smac/env/starcraft2/maps/smac_maps.py class SMACMap (line 8) | class SMACMap(lib.Map): function get_smac_map_registry (line 227) | def get_smac_map_registry(): FILE: examples/Social_Cognition/ToCM/smac/env/starcraft2/render.py function clamp (line 20) | def clamp(n, smallest, largest): function _get_desktop_size (line 24) | def _get_desktop_size(): class StarCraft2Renderer (line 42) | class StarCraft2Renderer: method __init__ (line 43) | def __init__(self, env, mode): method close (line 110) | def close(self): method _get_units (line 114) | def _get_units(self): method get_unit_name (line 121) | def get_unit_name(self, surf, name, radius): method render (line 134) | def render(self, mode): method draw_base_map (line 170) | def draw_base_map(self, surf): method draw_units (line 190) | def draw_units(self, surf): method draw_overlay (line 310) | def draw_overlay(self, surf): method draw_screen (line 343) | def draw_screen(self, surf): FILE: examples/Social_Cognition/ToCM/smac/env/starcraft2/starcraft2.py class Direction (line 54) | class Direction(enum.IntEnum): class StarCraft2Env (line 61) | class StarCraft2Env(MultiAgentEnv): method __init__ (line 65) | def __init__( method _launch (line 315) | def _launch(self): method reset (line 395) | def reset(self): method _restart (line 434) | def _restart(self): method full_restart (line 445) | def full_restart(self): method step (line 451) | def step(self, actions): method get_agent_action (line 547) | def get_agent_action(self, a_id, action): method get_agent_action_heuristic (line 656) | def get_agent_action_heuristic(self, a_id, action): method reward_battle (line 773) | def reward_battle(self): method get_total_actions (line 830) | def get_total_actions(self): method distance (line 835) | def distance(x1, y1, x2, y2): method unit_shoot_range (line 839) | def unit_shoot_range(self, agent_id): method unit_sight_range (line 843) | def unit_sight_range(self, agent_id): method unit_max_cooldown (line 847) | def unit_max_cooldown(self, unit): method save_replay (line 862) | def save_replay(self): method unit_max_shield (line 873) | def unit_max_shield(self, unit): method can_move (line 882) | def can_move(self, unit, direction): method get_surrounding_points (line 900) | def get_surrounding_points(self, unit, include_self=False): method check_bounds (line 923) | def check_bounds(self, x, y): method get_surrounding_pathing (line 927) | def get_surrounding_pathing(self, unit): method get_surrounding_height (line 936) | def get_surrounding_height(self, unit): method get_obs_agent (line 945) | def get_obs_agent(self, agent_id): method get_obs (line 1126) | def get_obs(self): method get_state (line 1134) | def get_state(self): method get_ally_num_attributes (line 1165) | def get_ally_num_attributes(self): method get_enemy_num_attributes (line 1168) | def get_enemy_num_attributes(self): method get_state_dict (line 1171) | def get_state_dict(self): method get_obs_enemy_feats_size (line 1259) | def get_obs_enemy_feats_size(self): method get_obs_ally_feats_size (line 1270) | def get_obs_ally_feats_size(self): method get_obs_own_feats_size (line 1284) | def get_obs_own_feats_size(self): method get_obs_move_feats_size (line 1296) | def get_obs_move_feats_size(self): method get_obs_size (line 1308) | def get_obs_size(self): method get_state_size (line 1321) | def get_state_size(self): method get_visibility_matrix (line 1341) | def get_visibility_matrix(self): method get_unit_type_id (line 1384) | def get_unit_type_id(self, unit, ally): method get_avail_agent_actions (line 1415) | def get_avail_agent_actions(self, agent_id): method get_avail_actions (line 1461) | def get_avail_actions(self): method close (line 1469) | def close(self): method seed (line 1477) | def seed(self): method render (line 1481) | def render(self, mode="human"): method _kill_all_units (line 1491) | def _kill_all_units(self): method init_units (line 1501) | def init_units(self): method get_unit_types (line 1564) | def get_unit_types(self): method update_units (line 1573) | def update_units(self): method _init_ally_unit_types (line 1625) | def _init_ally_unit_types(self, min_unit_type): method only_medivac_left (line 1655) | def only_medivac_left(self, ally): method get_unit_by_id (line 1679) | def get_unit_by_id(self, a_id): method get_stats (line 1683) | def get_stats(self): method get_env_info (line 1694) | def get_env_info(self): FILE: examples/Social_Cognition/ToCM/smac/examples/pettingzoo/pettingzoo_demo.py function main (line 10) | def main(): FILE: examples/Social_Cognition/ToCM/smac/examples/random_agents.py function main (line 9) | def main(): FILE: examples/Social_Cognition/ToCM/smac/examples/rllib/env.py class RLlibStarCraft2Env (line 16) | class RLlibStarCraft2Env(rllib.MultiAgentEnv): method __init__ (line 19) | def __init__(self, **smac_args): method reset (line 44) | def reset(self): method step (line 62) | def step(self, action_dict): method close (line 109) | def close(self): method seed (line 113) | def seed(self, seed): FILE: examples/Social_Cognition/ToCM/smac/examples/rllib/model.py class MaskedActionsModel (line 11) | class MaskedActionsModel(Model): method _build_layers_v2 (line 17) | def _build_layers_v2(self, input_dict, num_outputs, options): FILE: examples/Social_Cognition/ToCM/smac/examples/rllib/run_qmix.py function env_creator (line 28) | def env_creator(smac_args): FILE: examples/Social_Cognition/ToCM/train.py function occumpy_mem (line 20) | def occumpy_mem(cuda_device): function parse_args (line 30) | def parse_args(): function setup_seed (line 49) | def setup_seed(seed): function train_ToCM (line 60) | def train_ToCM(exp, n_workers): # no env.episode_length function get_env_info (line 65) | def get_env_info(configs, env): function get_env_info_mpe (line 72) | def get_env_info_mpe(configs, env): # add to ToCM controller and worker function prepare_starcraft_configs (line 84) | def prepare_starcraft_configs(env_name, device): function prepare_mpe_configs (line 98) | def prepare_mpe_configs(arg): FILE: examples/Social_Cognition/ToCM/utils/mlp_buffer.py function _cast (line 6) | def _cast(x): class MlpReplayBuffer (line 10) | class MlpReplayBuffer(object): method __init__ (line 11) | def __init__(self, policy_info, policy_agents, buffer_size, use_same_s... method __len__ (line 36) | def __len__(self): method insert (line 39) | def insert(self, num_insert_steps, obs, share_obs, acts, rewards, method sample (line 71) | def sample(self, batch_size): class MlpPolicyBuffer (line 98) | class MlpPolicyBuffer(object): method __init__ (line 100) | def __init__(self, buffer_size, num_agents, obs_space, share_obs_space... method __len__ (line 158) | def __len__(self): method insert (line 161) | def insert(self, num_insert_steps, obs, share_obs, acts, rewards, method sample_inds (line 210) | def sample_inds(self, sample_inds): class PrioritizedMlpReplayBuffer (line 260) | class PrioritizedMlpReplayBuffer(MlpReplayBuffer): method __init__ (line 261) | def __init__(self, alpha, policy_info, policy_agents, buffer_size, use... method insert (line 277) | def insert(self, num_insert_steps, obs, share_obs, acts, rewards, next... method _sample_proportional (line 289) | def _sample_proportional(self, batch_size, p_id=None): method sample (line 295) | def sample(self, batch_size, beta=0, p_id=None): method update_priorities (line 322) | def update_priorities(self, idxes, priorities, p_id=None): FILE: examples/Social_Cognition/ToCM/utils/mlp_nstep_buffer.py class NStepReplayBuffer (line 6) | class NStepReplayBuffer: method __init__ (line 7) | def __init__(self, max_size, episode_len, n, policy_ids, agent_ids, po... method push (line 21) | def push(self, t_env, observation_batch, action_batch, reward_batch, n... method sample (line 52) | def sample(self, batch_size): class NStepPolicyBuffer (line 76) | class NStepPolicyBuffer: method __init__ (line 77) | def __init__(self, policy_id, max_size, episode_len, n, policy_agents,... method push (line 101) | def push(self, num_envs, t_env, observation_batch, action_batch, rewar... method get (line 141) | def get(self, batch_inds, start_inds): FILE: examples/Social_Cognition/ToCM/utils/popart.py class PopArt (line 8) | class PopArt(nn.Module): method __init__ (line 11) | def __init__(self, input_shape, norm_axes=1, beta=0.99999, per_element... method reset_parameters (line 26) | def reset_parameters(self): method running_mean_var (line 31) | def running_mean_var(self): method forward (line 37) | def forward(self, input_vector, train=True): method denormalize (line 62) | def denormalize(self, input_vector): FILE: examples/Social_Cognition/ToCM/utils/rec_buffer.py function _cast (line 6) | def _cast(x): class RecReplayBuffer (line 10) | class RecReplayBuffer(object): method __init__ (line 11) | def __init__(self, policy_info, policy_agents, buffer_size, episode_le... method __len__ (line 36) | def __len__(self): method insert (line 39) | def insert(self, num_insert_episodes, obs, share_obs, acts, rewards, d... method sample (line 62) | def sample(self, batch_size): class RecPolicyBuffer (line 85) | class RecPolicyBuffer(object): method __init__ (line 86) | def __init__(self, buffer_size, episode_length, num_agents, obs_space,... method __len__ (line 143) | def __len__(self): method insert (line 146) | def insert(self, num_insert_episodes, obs, share_obs, acts, rewards, d... method sample_inds (line 192) | def sample_inds(self, sample_inds): class PrioritizedRecReplayBuffer (line 243) | class PrioritizedRecReplayBuffer(RecReplayBuffer): method __init__ (line 244) | def __init__(self, alpha, policy_info, policy_agents, buffer_size, epi... method insert (line 262) | def insert(self, num_insert_episodes, obs, share_obs, acts, rewards, d... method _sample_proportional (line 272) | def _sample_proportional(self, batch_size, p_id=None): method sample (line 278) | def sample(self, batch_size, beta=0, p_id=None): method update_priorities (line 306) | def update_priorities(self, idxes, priorities, p_id=None): FILE: examples/Social_Cognition/ToCM/utils/segment_tree.py function unique (line 4) | def unique(sorted_array): class SegmentTree (line 18) | class SegmentTree(object): method __init__ (line 19) | def __init__(self, capacity, operation, neutral_element): method _reduce_helper (line 42) | def _reduce_helper(self, start, end, node, node_start, node_end): method reduce (line 58) | def reduce(self, start=0, end=None): method __setitem__ (line 74) | def __setitem__(self, idx, val): method __getitem__ (line 91) | def __getitem__(self, idx): class SumSegmentTree (line 97) | class SumSegmentTree(SegmentTree): method __init__ (line 98) | def __init__(self, capacity): method sum (line 106) | def sum(self, start=0, end=None): method find_prefixsum_idx (line 115) | def find_prefixsum_idx(self, prefixsum): class MinSegmentTree (line 149) | class MinSegmentTree(SegmentTree): method __init__ (line 150) | def __init__(self, capacity): method min (line 158) | def min(self, start=0, end=None): FILE: examples/Social_Cognition/ToCM/utils/util.py function to_torch (line 12) | def to_torch(input): function to_numpy (line 15) | def to_numpy(x): class FixedCategorical (line 18) | class FixedCategorical(torch.distributions.Categorical): method sample (line 19) | def sample(self): method log_probs (line 22) | def log_probs(self, actions): method mode (line 31) | def mode(self): class MultiDiscrete (line 35) | class MultiDiscrete(gym.Space): method __init__ (line 52) | def __init__(self, array_of_param_array): method sample (line 58) | def sample(self): method contains (line 64) | def contains(self, x): method shape (line 68) | def shape(self): method __repr__ (line 71) | def __repr__(self): method __eq__ (line 74) | def __eq__(self, other): class DecayThenFlatSchedule (line 78) | class DecayThenFlatSchedule(): method __init__ (line 79) | def __init__(self, method eval (line 95) | def eval(self, T): function huber_loss (line 103) | def huber_loss(e, d): function mse_loss (line 109) | def mse_loss(e): function init (line 113) | def init(module, weight_init, bias_init, gain=1): function get_clones (line 119) | def get_clones(module, N): function soft_update (line 123) | def soft_update(target, source, tau): function hard_update (line 137) | def hard_update(target, source): function average_gradients (line 148) | def average_gradients(model): function onehot_from_logits (line 156) | def onehot_from_logits(logits, avail_logits=None, eps=0.0): function sample_gumbel (line 178) | def sample_gumbel(shape, eps=1e-20, tens_type=torch.FloatTensor): function gumbel_softmax_sample (line 184) | def gumbel_softmax_sample(logits, avail_logits, temperature, device=torc... function gumbel_softmax (line 199) | def gumbel_softmax(logits, avail_logits=None, temperature=1.0, hard=Fals... function gaussian_noise (line 217) | def gaussian_noise(shape, std): function get_obs_shape (line 221) | def get_obs_shape(obs_space): function get_dim_from_space (line 231) | def get_dim_from_space(space): function get_state_dim (line 247) | def get_state_dim(observation_dict, action_dict): function get_cent_act_dim (line 260) | def get_cent_act_dim(action_space): function is_discrete (line 271) | def is_discrete(space): function is_multidiscrete (line 278) | def is_multidiscrete(space): function make_onehot (line 285) | def make_onehot(int_action, action_dim, seq_len=None): function avail_choose (line 298) | def avail_choose(x, avail_x=None): function tile_images (line 306) | def tile_images(img_nhwc): FILE: examples/Social_Cognition/ToM/BrainArea/PFC_ToM.py class PFC_ToM (line 17) | class PFC_ToM(dlPFC): method __init__ (line 21) | def __init__(self, method _rest_c (line 48) | def _rest_c(self): method _create_fc (line 52) | def _create_fc(self): method update_c (line 61) | def update_c(self, c, dw, tau_c=0.2): method _call_reward (line 78) | def _call_reward(self, R, c, s, T_map): # eligibility method update_s (line 104) | def update_s(self, R, mapping): method forward (line 111) | def forward(self, inputs, num_action, episode): FILE: examples/Social_Cognition/ToM/BrainArea/TPJ.py class ToM (line 23) | class ToM: method __init__ (line 24) | def __init__(self, env): method TPJ (line 36) | def TPJ(self, NPC_num, axis, obs): method gain_obs (line 70) | def gain_obs(self, a,aa,b,c,bb,cc): method belief_reasoning (line 85) | def belief_reasoning(self, test_x, net_NPC, num_action, episode): method state_evaluation (line 91) | def state_evaluation(self, prediction_next_state): method prediction_state (line 111) | def prediction_state(self, axis_new, axis, action_NPC1, net, num_actio... method altruism (line 144) | def altruism(self, axis_switch, axis_NPC, n_actions): method INS (line 207) | def INS(self, axis1, axis2): FILE: examples/Social_Cognition/ToM/BrainArea/dACC.py class dACC (line 16) | class dACC(BaseModule): method __init__ (line 20) | def __init__(self, method _rest_c (line 41) | def _rest_c(self): method _create_fc (line 45) | def _create_fc(self): method update_c (line 54) | def update_c(self, c, STDP, tau_c=0.2): method forward (line 69) | def forward(self, inputs, epoch): FILE: examples/Social_Cognition/ToM/BrainArea/one_hot.py function one_hot (line 4) | def one_hot(value): FILE: examples/Social_Cognition/ToM/data/one_hot.py function one_hot (line 4) | def one_hot(value): FILE: examples/Social_Cognition/ToM/env/env.py class FalseBelief_env (line 58) | class FalseBelief_env(object): method __init__ (line 59) | def __init__(self, reward=10): method _build_AB (line 82) | def _build_AB(self): method _agent_init (line 92) | def _agent_init(self): method actu_obs (line 130) | def actu_obs(self): method gain_obs (line 177) | def gain_obs(self, a, aa, b, c, bb, cc): method gain_axis (line 196) | def gain_axis(self,a,aa,b,c,bb,cc): method interact (line 219) | def interact(self, action_NPC1, action_NPC2, action_agent): method SHOW (line 328) | def SHOW(self): method reset (line 341) | def reset(self): method getBlankBoard (line 344) | def getBlankBoard(self): method ValidPos (line 360) | def ValidPos(self, piece1, piece2, xT=0, yT=0): method isNotWall (line 373) | def isNotWall(self, board, piece, xT=0 , yT=0 ): method gameover (line 387) | def gameover(self, location): method pixel (line 408) | def pixel(self, xbox, ybox): method DrawBox (line 411) | def DrawBox(self, xbox, ybox, color, xpixel=None, ypixel=None): method fun_trigger (line 435) | def fun_trigger(self): method DrawCircle (line 440) | def DrawCircle(self, xbox, ybox, color, xpixel=None, ypixel=None): method DrawPiece (line 454) | def DrawPiece(self, piece, xpixel=None, ypixel=None): method DrawBoard (line 462) | def DrawBoard(self, board): method ShowScore (line 471) | def ShowScore(self, score): method Terminal (line 477) | def Terminal(self, piece1, piece2, piece1_old, piece2_old): method Paint (line 485) | def Paint(self, board, piece, color): FILE: examples/Social_Cognition/ToM/env/env3_train_env00.py class FalseBelief_env0 (line 55) | class FalseBelief_env0(object): method __init__ (line 56) | def __init__(self, reward=10): method _build_AB (line 78) | def _build_AB(self): method _agent_init (line 88) | def _agent_init(self): method actu_obs (line 126) | def actu_obs(self): method gain_obs (line 173) | def gain_obs(self, a, aa, b, c, bb, cc): method gain_axis (line 192) | def gain_axis(self,a,aa,b,c,bb,cc): method interact (line 215) | def interact(self, action_NPC1, action_NPC2, action_agent): method SHOW (line 324) | def SHOW(self): method reset (line 337) | def reset(self): method getBlankBoard (line 340) | def getBlankBoard(self): method ValidPos (line 357) | def ValidPos(self, piece1, piece2, xT=0, yT=0): method isNotWall (line 370) | def isNotWall(self, board, piece, xT=0 , yT=0 ): method gameover (line 384) | def gameover(self, location): method pixel (line 405) | def pixel(self, xbox, ybox): method DrawBox (line 408) | def DrawBox(self, xbox, ybox, color, xpixel=None, ypixel=None): method DrawCircle (line 432) | def DrawCircle(self, xbox, ybox, color, xpixel=None, ypixel=None): method DrawPiece (line 446) | def DrawPiece(self, piece, xpixel=None, ypixel=None): method DrawBoard (line 454) | def DrawBoard(self, board): method ShowScore (line 462) | def ShowScore(self, score): method Terminal (line 468) | def Terminal(self, piece1, piece2, piece1_old, piece2_old): method Paint (line 476) | def Paint(self, board, piece, color): FILE: examples/Social_Cognition/ToM/env/env3_train_env01.py class FalseBelief_env1 (line 59) | class FalseBelief_env1(object): method __init__ (line 60) | def __init__(self, reward=10): method _build_AB (line 82) | def _build_AB(self): method _agent_init (line 93) | def _agent_init(self): method actu_obs (line 120) | def actu_obs(self): method gain_obs (line 152) | def gain_obs(self, a,aa,c,cc): method gain_axis (line 158) | def gain_axis(self,a,aa,b,c,bb,cc): method interact (line 172) | def interact(self, action_NPC2, action_agent): method SHOW (line 252) | def SHOW(self): method reset (line 262) | def reset(self): method getBlankBoard (line 265) | def getBlankBoard(self): method ValidPos (line 276) | def ValidPos(self, piece1, piece2, xT=0, yT=0): method isNotWall (line 289) | def isNotWall(self, board, piece, xT=0 , yT=0 ): method gameover (line 295) | def gameover(self, location): method pixel (line 312) | def pixel(self, xbox, ybox): method DrawBox (line 315) | def DrawBox(self, xbox, ybox, color, xpixel=None, ypixel=None): method DrawCircle (line 339) | def DrawCircle(self, xbox, ybox, color, xpixel=None, ypixel=None): method DrawPiece (line 345) | def DrawPiece(self, piece, xpixel=None, ypixel=None): method DrawBoard (line 353) | def DrawBoard(self, board): method ShowScore (line 361) | def ShowScore(self, score): method Terminal (line 367) | def Terminal(self, piece1, piece2, piece1_old, piece2_old): method Paint (line 375) | def Paint(self, board, piece, color): FILE: examples/Social_Cognition/ToM/main_ToM.py function update (line 68) | def update(env, net_agent_belief, net_NPC, episodes, trajectories): function train (line 158) | def train(): FILE: examples/Social_Cognition/ToM/main_both.py function reward_plot (line 59) | def reward_plot(episodes, scores, Note): function update (line 72) | def update(env0, env1, net_agent, net_NPC, episodes, trajectories, task): function train (line 203) | def train(): function test (line 239) | def test(): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/Find_a_way.py function Find_a_way (line 13) | def Find_a_way(size, board, start_x, start_y, end_x, end_y): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/a_star.py class AStar (line 11) | class AStar: method __init__ (line 12) | def __init__(self, map): method BaseCost (line 17) | def BaseCost(self, p): method HeuristicCost (line 23) | def HeuristicCost(self, p): method TotalCost (line 29) | def TotalCost(self, p): method IsValidPoint (line 32) | def IsValidPoint(self, x, y): method IsInPointList (line 39) | def IsInPointList(self, p, point_list): method IsInOpenList (line 45) | def IsInOpenList(self, p): method IsInCloseList (line 48) | def IsInCloseList(self, p): method IsStartPoint (line 51) | def IsStartPoint(self, p, start_x, start_y): method IsEndPoint (line 54) | def IsEndPoint(self, p, end_x, end_y): method SaveImage (line 57) | def SaveImage(self, plt): method ProcessPoint (line 62) | def ProcessPoint(self, x, y, parent): method SelectPointInOpenList (line 74) | def SelectPointInOpenList(self): method BuildPath (line 86) | def BuildPath(self, p, start_time, start_x, start_y, end_x, end_y):#a... method RunAndSaveImage (line 123) | def RunAndSaveImage(self, start_x, start_y, end_x, end_y):#ax, plt, FILE: examples/Social_Cognition/ToM/rulebasedpolicy/load_statedata.py class StateDataset (line 11) | class StateDataset: method __init__ (line 13) | def __init__(self, mode, num): method __getitem__ (line 19) | def __getitem__(self, item): method __len__ (line 30) | def __len__(self): function get_dataloader (line 35) | def get_dataloader(mode, num, batch): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/point.py class Point (line 3) | class Point: method __init__ (line 4) | def __init__(self, x, y): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/random_map.py class RandomMap (line 5) | class RandomMap: method __init__ (line 6) | def __init__(self, size, board): method GenerateObstacle (line 12) | def GenerateObstacle(self): method IsObstacle (line 22) | def IsObstacle(self, i ,j): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/statedata_pre.py function data_transfer (line 3) | def data_transfer(B_txt, A_txt): FILE: examples/Social_Cognition/ToM/rulebasedpolicy/world_model.py function data (line 9) | def data(): function flip180 (line 27) | def flip180(arr): function flip90_left (line 38) | def flip90_left(arr): function flip90_right (line 48) | def flip90_right(arr): function gain_env (line 60) | def gain_env(obs, agent, wall): function shelter_env (line 106) | def shelter_env(obs): function big_env (line 181) | def big_env(env): FILE: examples/Social_Cognition/ToM/utils/Encoder.py class PopEncoder (line 9) | class PopEncoder(nn.Module): method __init__ (line 13) | def __init__(self, step, encode_type): method forward (line 19) | def forward(self, inputs, *args, **kwargs): method rate (line 23) | def rate(self, inputs, pop , num_state): FILE: examples/Social_Cognition/ToM/utils/one_hot.py function one_hot (line 3) | def one_hot(value): FILE: examples/Social_Cognition/affective_empathy/BAE-SNN/BAESNN.py class BrainArea (line 22) | class BrainArea(nn.Module, abc.ABC): method __init__ (line 28) | def __init__(self): method forward (line 34) | def forward(self, x): method reset (line 42) | def reset(self): class BAESNN (line 51) | class BAESNN(BrainArea): method __init__ (line 56) | def __init__(self,): method forward (line 113) | def forward(self, x1,x2): method empathy (line 126) | def empathy(self,x3): method UpdateWeight (line 133) | def UpdateWeight(self, i, dw, delta): method reset (line 143) | def reset(self): function BAESNN_train (line 153) | def BAESNN_train(): function BAESNN_test (line 232) | def BAESNN_test(): FILE: examples/Social_Cognition/affective_empathy/BAE-SNN/env_poly.py class Maze (line 12) | class Maze(tk.Tk, object): method __init__ (line 13) | def __init__(self): method _build_maze (line 27) | def _build_maze(self): method reset (line 132) | def reset(self): method step (line 160) | def step(self, s, action, pain): method step_RL1 (line 377) | def step_RL1(self, action): method step_RL2 (line 419) | def step_RL2(self, action): method _set_danger (line 486) | def _set_danger(self): method _set_switch (line 497) | def _set_switch(self): method _set_wall (line 507) | def _set_wall(self): method generate_expression (line 526) | def generate_expression(self,pain): method render (line 534) | def render(self): FILE: examples/Social_Cognition/affective_empathy/BAE-SNN/env_two_poly.py class Maze2 (line 13) | class Maze2(tk.Tk, object): method __init__ (line 14) | def __init__(self): method _build_maze (line 31) | def _build_maze(self): method reset (line 123) | def reset(self): method step1 (line 174) | def step1(self, action1,pain): method agent_help (line 398) | def agent_help(self): method _set_danger (line 418) | def _set_danger(self): method _set_wall (line 434) | def _set_wall(self): method generate_expression1 (line 449) | def generate_expression1(self,pain1): method render (line 456) | def render(self): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/BEEAD-SNN.py class BrainArea (line 26) | class BrainArea(nn.Module, abc.ABC): method __init__ (line 28) | def __init__(self): method forward (line 32) | def forward(self, x): method reset (line 39) | def reset(self): class BAESNN (line 46) | class BAESNN(BrainArea): method __init__ (line 51) | def __init__(self,): method forward (line 95) | def forward(self, x1,x2): method empathy (line 104) | def empathy(self,x3): method UpdateWeight (line 111) | def UpdateWeight(self, i, dw, delta): method reset (line 115) | def reset(self): class DopamineArea (line 121) | class DopamineArea(BrainArea): method __init__ (line 125) | def __init__(self, n_neurons, beta=0.2): method forward (line 131) | def forward(self, spikes): method reset (line 140) | def reset(self): function BAESNN_train (line 145) | def BAESNN_train(): function BAESNN_train_alstruism (line 234) | def BAESNN_train_alstruism(lamda, E): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/RL_Brain.py class QLearningTable (line 4) | class QLearningTable: method __init__ (line 5) | def __init__(self, actions, learning_rate=0.1, reward_decay=0.9): method choose_action (line 14) | def choose_action(self, observation,e_greedy): method learn_A (line 35) | def learn_A(self, s, a, r, s_,done_oval): method A_chack_q_table_A (line 46) | def A_chack_q_table_A(self, state): class EnvModel (line 65) | class EnvModel: method __init__ (line 68) | def __init__(self, actions): method store_transition (line 73) | def store_transition(self, s, a, r, s_): method sample_s_a (line 91) | def sample_s_a(self): method get_r_s_ (line 96) | def get_r_s_(self, s, a): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/env.py class Maze2 (line 11) | class Maze2(tk.Tk, object): method __init__ (line 12) | def __init__(self,lamda=0): method _build_maze (line 30) | def _build_maze(self): method reset (line 151) | def reset(self): method step1 (line 206) | def step1(self, s1, action1,emotion): method is_agent1_in_danger (line 400) | def is_agent1_in_danger(self): method step2 (line 415) | def step2(self, action): method reward2 (line 462) | def reward2(self): method _set_wall (line 486) | def _set_wall(self): method generate_expression1 (line 511) | def generate_expression1(self,emotion): method generate_expression2 (line 520) | def generate_expression2(self,emotion): method render (line 529) | def render(self): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/env_poly_SNN.py class Maze (line 11) | class Maze(tk.Tk, object): method __init__ (line 12) | def __init__(self): method _build_maze (line 26) | def _build_maze(self): method reset (line 52) | def reset(self): method step (line 69) | def step(self, s, action, pain): method _set_danger (line 236) | def _set_danger(self): method _set_switch (line 247) | def _set_switch(self): method _set_wall (line 256) | def _set_wall(self): method generate_expression (line 273) | def generate_expression(self,pain): method render (line 279) | def render(self): method is_agent_in_danger (line 283) | def is_agent_in_danger(self): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/rsnn.py class RSNN (line 13) | class RSNN(nn.Module): method __init__ (line 14) | def __init__(self,num_state,num_action): method forward (line 36) | def forward(self, input): method UpdateWeight (line 42) | def UpdateWeight(self,reward,a,C,n): method reset (line 56) | def reset(self): method getweight (line 61) | def getweight(self): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/sd_env.py class Snowdrift (line 11) | class Snowdrift(tk.Tk, object): method __init__ (line 12) | def __init__(self, n_agents=3, n_snowdrifts=4): method _build_maze (line 36) | def _build_maze(self): method reset (line 71) | def reset(self, agent_id): method step_all (line 114) | def step_all(self, actions): method _get_state_index (line 188) | def _get_state_index(self, agent_id): method render (line 197) | def render(self): FILE: examples/Social_Cognition/affective_empathy/BEEAD-SNN/snowdrift_main.py function encode (line 22) | def encode(n, e): function aoencode (line 28) | def aoencode(n, e, env, agent_id): function poencode (line 47) | def poencode(n, e, env, agent_id): function chooseAct (line 80) | def chooseAct(Net, input, explore, n, env, agent_id): function train_model (line 113) | def train_model(n_agents, lamdas, episodes): FILE: examples/Social_Cognition/affective_empathy/BRP-SNN/BRP-SNN.py class BrainArea (line 40) | class BrainArea(nn.Module, abc.ABC): method __init__ (line 46) | def __init__(self): method forward (line 52) | def forward(self, x): method reset (line 60) | def reset(self): class BNESNN (line 69) | class BNESNN(BrainArea): method __init__ (line 73) | def __init__(self,): method forward (line 115) | def forward(self, x1,x2): method calculate_error (line 124) | def calculate_error(self, x1,x2): method UpdateWeight (line 137) | def UpdateWeight(self, i, dw, delta): method reset (line 147) | def reset(self): function GRF (line 158) | def GRF(X,N): function encode (line 211) | def encode(input,n_neuron): class BAESNN (line 225) | class BAESNN(BrainArea): method __init__ (line 230) | def __init__(self,): method forward (line 284) | def forward(self, x1,x2): method empathy (line 297) | def empathy(self,x3): method UpdateWeight (line 304) | def UpdateWeight(self, i, dw, delta): method reset (line 314) | def reset(self): function BNESNN_train (line 324) | def BNESNN_train(): function BAESNN_train (line 345) | def BAESNN_train(): function BAESNN_test (line 447) | def BAESNN_test(): FILE: examples/Social_Cognition/affective_empathy/BRP-SNN/env_poly_SNN.py class Maze (line 12) | class Maze(tk.Tk, object): method __init__ (line 13) | def __init__(self): method _build_maze (line 27) | def _build_maze(self): method reset (line 65) | def reset(self): method step (line 93) | def step(self, s, action, pain): method _set_danger (line 313) | def _set_danger(self): method _set_switch (line 324) | def _set_switch(self): method _set_wall (line 334) | def _set_wall(self): method generate_expression (line 353) | def generate_expression(self,pain): method render (line 361) | def render(self): FILE: examples/Social_Cognition/affective_empathy/BRP-SNN/env_two_poly_SNN.py class Maze2 (line 13) | class Maze2(tk.Tk, object): method __init__ (line 14) | def __init__(self): method _build_maze (line 31) | def _build_maze(self): method reset (line 123) | def reset(self): method step (line 174) | def step(self, s, action, pain): method agent_help (line 412) | def agent_help(self): method _set_danger (line 432) | def _set_danger(self): method _set_wall (line 448) | def _set_wall(self): method generate_expression1 (line 463) | def generate_expression1(self,pain1): method render (line 470) | def render(self): FILE: examples/Spiking-Transformers/LIFNode.py class MyBaseNode (line 10) | class MyBaseNode(BaseNode): method __init__ (line 11) | def __init__(self, threshold=0.5, step=4, layer_by_layer=False, mem_de... method rearrange2node (line 14) | def rearrange2node(self, inputs): method rearrange2op (line 41) | def rearrange2op(self, inputs): class MyGrad (line 67) | class MyGrad(SurrogateFunctionBase): method __init__ (line 68) | def __init__(self, alpha=4., requires_grad=False): method act_fun (line 72) | def act_fun(x, alpha): class MyNode (line 76) | class MyNode(MyBaseNode): method __init__ (line 77) | def __init__(self, threshold=1., step=4, layer_by_layer=True, tau=2., ... method integral (line 85) | def integral(self, inputs): method calc_spike (line 88) | def calc_spike(self): FILE: examples/Spiking-Transformers/datasets.py function unpack_mix_param (line 52) | def unpack_mix_param(args): function build_transform (line 65) | def build_transform(is_train, img_size): function build_dataset (line 109) | def build_dataset(is_train, img_size, dataset, path, same_da=False): class MNISTData (line 135) | class MNISTData(object): method __init__ (line 140) | def __init__(self, method get_data_loaders (line 157) | def get_data_loaders(self): method get_standard_data (line 171) | def get_standard_data(self): function get_mnist_data (line 182) | def get_mnist_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_fashion_data (line 228) | def get_fashion_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_cifar10_data (line 261) | def get_cifar10_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_cifar100_data (line 305) | def get_cifar100_data(batch_size, num_workers=8, same_data=False, *args,... function get_imnet_data (line 348) | def get_imnet_data(args, _logger, data_config, num_aug_splits, **kwargs): function get_dvsg_data (line 440) | def get_dvsg_data(batch_size, step, **kwargs): function get_dvsc10_data (line 541) | def get_dvsc10_data(batch_size, step, **kwargs): function get_nmnist_data (line 663) | def get_nmnist_data(batch_size, step, **kwargs): function get_NCALTECH101_data (line 785) | def get_NCALTECH101_data(batch_size, step, **kwargs): function get_UCF101DVS_data (line 914) | def get_UCF101DVS_data(batch_size, step, **kwargs): function get_HMDBDVS_data (line 1020) | def get_HMDBDVS_data(batch_size, step, **kwargs): function get_nomni_data (line 1247) | def get_nomni_data(batch_size, train_portion=1., **kwargs): FILE: examples/Spiking-Transformers/main.py function _parse_args (line 358) | def _parse_args(): function main (line 376) | def main(): function train_epoch (line 747) | def train_epoch( function validate (line 897) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/Spiking-Transformers/models/spike_driven_transformer.py class MLP (line 21) | class MLP(BaseModule): method __init__ (line 23) | def __init__(self, in_features, step=10, encode_type='direct', hidden_... method forward (line 38) | def forward(self, x): class SSA (line 53) | class SSA(BaseModule): method __init__ (line 54) | def __init__(self, dim, step=10, encode_type='direct', num_heads=16, q... method forward (line 89) | def forward(self, x): class Block (line 128) | class Block(nn.Module): method __init__ (line 129) | def __init__(self, dim, num_heads, step=10, mlp_ratio=4., qkv_bias=Fal... method forward (line 139) | def forward(self, x): class SPS (line 147) | class SPS(BaseModule): method __init__ (line 148) | def __init__(self, step=10, encode_type='direct', img_size_h=128, img_... method forward (line 184) | def forward(self, x): class Spikformer (line 222) | class Spikformer(BaseModule): method __init__ (line 223) | def __init__(self, step=10, encode_type='direct', method _get_pos_embed (line 262) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 270) | def _init_weights(self, m): method forward_features (line 279) | def forward_features(self, x): method forward (line 292) | def forward(self, x): function sd_transformer (line 303) | def sd_transformer(pretrained=False, **kwargs): FILE: examples/Spiking-Transformers/models/spike_driven_transformer_dvs.py class MLP (line 21) | class MLP(BaseModule): method __init__ (line 23) | def __init__(self, in_features, step=10, encode_type='direct', hidden_... method forward (line 38) | def forward(self, x): class SSA (line 53) | class SSA(BaseModule): method __init__ (line 54) | def __init__(self, dim, step=10, encode_type='direct', num_heads=16, q... method forward (line 89) | def forward(self, x): class Block (line 128) | class Block(nn.Module): method __init__ (line 129) | def __init__(self, dim, num_heads, step=10, mlp_ratio=4., qkv_bias=Fal... method forward (line 139) | def forward(self, x): class SPS (line 147) | class SPS(BaseModule): method __init__ (line 148) | def __init__(self, step=10, encode_type='direct', img_size_h=128, img_... method forward (line 184) | def forward(self, x): class Spikformer (line 222) | class Spikformer(BaseModule): method __init__ (line 223) | def __init__(self, step=10, encode_type='direct', method _get_pos_embed (line 262) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 270) | def _init_weights(self, m): method forward_features (line 279) | def forward_features(self, x): method forward (line 292) | def forward(self, x): function sd_transformer_dvs (line 303) | def sd_transformer_dvs(pretrained=False, **kwargs): FILE: examples/Spiking-Transformers/models/spike_driven_transformer_v2.py class BNAndPadLayer (line 24) | class BNAndPadLayer(nn.Module): method __init__ (line 25) | def __init__( method forward (line 40) | def forward(self, input): method weight (line 62) | def weight(self): method bias (line 66) | def bias(self): method running_mean (line 70) | def running_mean(self): method running_var (line 74) | def running_var(self): method eps (line 78) | def eps(self): class RepConv (line 82) | class RepConv(nn.Module): method __init__ (line 83) | def __init__( method forward (line 101) | def forward(self, x): class SepConv (line 105) | class SepConv(BaseModule): method __init__ (line 110) | def __init__( method forward (line 138) | def forward(self, x): class MLP (line 149) | class MLP(BaseModule): method __init__ (line 151) | def __init__(self, in_features, step=10, encode_type='direct', hidden_... method forward (line 166) | def forward(self, x): class SDSA (line 187) | class SDSA(BaseModule): method __init__ (line 188) | def __init__(self, dim, step=10, encode_type='direct', num_heads=16, q... method forward (line 221) | def forward(self, x): class Block (line 261) | class Block(nn.Module): method __init__ (line 262) | def __init__(self, dim, num_heads, step=10, mlp_ratio=4., qkv_bias=Fal... method forward (line 272) | def forward(self, x): class DownSampling (line 278) | class DownSampling(BaseModule): method __init__ (line 279) | def __init__( method forward (line 307) | def forward(self, x): class ConvBlock (line 320) | class ConvBlock(BaseModule): method __init__ (line 321) | def __init__( method forward (line 347) | def forward(self, x): class Spikformer (line 359) | class Spikformer(BaseModule): method __init__ (line 360) | def __init__(self, step=4, encode_type='direct', method _get_pos_embed (line 499) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 507) | def _init_weights(self, m): method forward_features (line 516) | def forward_features(self, x): method forward (line 539) | def forward(self, x): function sd_transformer_v2 (line 559) | def sd_transformer_v2(pretrained=False, **kwargs): FILE: examples/Spiking-Transformers/models/spike_driven_transformer_v2_dvs.py class BNAndPadLayer (line 24) | class BNAndPadLayer(nn.Module): method __init__ (line 25) | def __init__( method forward (line 40) | def forward(self, input): method weight (line 62) | def weight(self): method bias (line 66) | def bias(self): method running_mean (line 70) | def running_mean(self): method running_var (line 74) | def running_var(self): method eps (line 78) | def eps(self): class RepConv (line 82) | class RepConv(nn.Module): method __init__ (line 83) | def __init__( method forward (line 101) | def forward(self, x): class SepConv (line 105) | class SepConv(BaseModule): method __init__ (line 110) | def __init__( method forward (line 138) | def forward(self, x): class MLP (line 149) | class MLP(BaseModule): method __init__ (line 151) | def __init__(self, in_features, step=10, encode_type='direct', hidden_... method forward (line 166) | def forward(self, x): class SDSA (line 187) | class SDSA(BaseModule): method __init__ (line 188) | def __init__(self, dim, step=10, encode_type='direct', num_heads=16, q... method forward (line 221) | def forward(self, x): class Block (line 261) | class Block(nn.Module): method __init__ (line 262) | def __init__(self, dim, num_heads, step=10, mlp_ratio=4., qkv_bias=Fal... method forward (line 272) | def forward(self, x): class DownSampling (line 278) | class DownSampling(BaseModule): method __init__ (line 279) | def __init__( method forward (line 307) | def forward(self, x): class ConvBlock (line 320) | class ConvBlock(BaseModule): method __init__ (line 321) | def __init__( method forward (line 347) | def forward(self, x): class Spikformer (line 359) | class Spikformer(BaseModule): method __init__ (line 360) | def __init__(self, step=10, encode_type='direct', method _get_pos_embed (line 499) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 507) | def _init_weights(self, m): method forward_features (line 516) | def forward_features(self, x): method forward (line 539) | def forward(self, x): function sd_transformer_v2_dvs (line 559) | def sd_transformer_v2_dvs(pretrained=False, **kwargs): FILE: examples/Spiking-Transformers/models/spikformer.py class MLP (line 17) | class MLP(BaseModule): method __init__ (line 19) | def __init__(self, in_features, step=4, encode_type='direct', hidden_f... method forward (line 34) | def forward(self, x): class SSA (line 51) | class SSA(BaseModule): method __init__ (line 52) | def __init__(self, dim, step=4, encode_type='rate', num_heads=12, qkv_... method forward (line 80) | def forward(self, x): class Block (line 114) | class Block(nn.Module): method __init__ (line 115) | def __init__(self, dim, num_heads, step =4, mlp_ratio=4., qkv_bias=Fa... method forward (line 126) | def forward(self, x): class SPS (line 135) | class SPS(BaseModule): method __init__ (line 136) | def __init__(self, step=4, encode_type='direct', img_size_h=32, img_si... method forward (line 170) | def forward(self, x): class Spikformer (line 204) | class Spikformer(BaseModule): method __init__ (line 205) | def __init__(self, step=4, encode_type='direct', method _get_pos_embed (line 240) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 248) | def _init_weights(self, m): method forward_features (line 257) | def forward_features(self, x): method forward (line 267) | def forward(self, x): function spikformer (line 275) | def spikformer(pretrained=False, **kwargs): FILE: examples/Spiking-Transformers/models/spikformer_dvs.py class MLP (line 20) | class MLP(BaseModule): method __init__ (line 22) | def __init__(self, in_features, step=10, encode_type='direct', hidden_... method forward (line 37) | def forward(self, x): class SSA (line 52) | class SSA(BaseModule): method __init__ (line 53) | def __init__(self, dim, step=10, encode_type='direct', num_heads=16, q... method forward (line 83) | def forward(self, x): class Block (line 118) | class Block(nn.Module): method __init__ (line 119) | def __init__(self, dim, num_heads, step=10, mlp_ratio=4., qkv_bias=Fal... method forward (line 129) | def forward(self, x): class SPS (line 137) | class SPS(BaseModule): method __init__ (line 138) | def __init__(self, step=10, encode_type='direct', img_size_h=128, img_... method forward (line 176) | def forward(self, x): class Spikformer (line 209) | class Spikformer(nn.Module): method __init__ (line 210) | def __init__(self, step=10, method _get_pos_embed (line 245) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 253) | def _init_weights(self, m): method forward_features (line 262) | def forward_features(self, x): method forward (line 272) | def forward(self, x): function spikformer_dvs (line 282) | def spikformer_dvs(pretrained=False, **kwargs): FILE: examples/Structural_Development/DPAP/mask_model.py class my_cifar_model (line 20) | class my_cifar_model(BaseModule): method __init__ (line 21) | def __init__(self, method _cflatten (line 51) | def _cflatten(self): method _create_fc_prun (line 57) | def _create_fc_prun(self): method _create_fc (line 63) | def _create_fc(self): method forward (line 69) | def forward(self, inputs): class Mask (line 102) | class Mask: method __init__ (line 103) | def __init__(self, model,batch,step): method init_length (line 118) | def init_length(self): method get_filter_codebook (line 133) | def get_filter_codebook(self,ww,dendrite,ii,index,epoch): method convert2tensor (line 174) | def convert2tensor(self, x): method init_mask (line 178) | def init_mask(self, wwfc,convtra,epoch): method do_mask (line 192) | def do_mask(self): method if_zero (line 204) | def if_zero(self): class Trace (line 218) | class Trace: method __init__ (line 219) | def __init__(self, model,batch,step): method computing_trace (line 230) | def computing_trace(self,spikes): FILE: examples/Structural_Development/DPAP/prun_main.py function BCM_and_trace (line 93) | def BCM_and_trace(NUM,trace,spikes,neuron_th,bcm,epoch_trace): function train_epoch (line 115) | def train_epoch( function validate (line 165) | def validate(model, loader, loss_fn, amp_autocast=suppress, log_suffix=''): FILE: examples/Structural_Development/DPAP/utils.py function print_log (line 5) | def print_log(print_string, log): function unit (line 10) | def unit(x): function unit_tensor (line 25) | def unit_tensor(x): function init (line 38) | def init(batch,convlayer,fclayer,size,fcsize): FILE: examples/Structural_Development/DSD-SNN/cifar100/main_simplified.py function _parse_args (line 191) | def _parse_args(): function get_dataset (line 207) | def get_dataset(name, type='train', download=True, capacity=None, permut... function main (line 238) | def main(): function train_epoch (line 421) | def train_epoch( function validate (line 522) | def validate(task, model, loader, loss_fn, args, mat,log_suffix='', visu... FILE: examples/Structural_Development/DSD-SNN/cifar100/manipulate.py function permutate_image_pixels (line 5) | def permutate_image_pixels(image, permutation): class SubDataset (line 22) | class SubDataset(Dataset): method __init__ (line 28) | def __init__(self, original_dataset, sub_labels, target_transform=None): method __len__ (line 49) | def __len__(self): method __getitem__ (line 52) | def __getitem__(self, index): class MemorySetDataset (line 60) | class MemorySetDataset(Dataset): method __init__ (line 65) | def __init__(self, memory_sets, target_transform=None): method __len__ (line 70) | def __len__(self): method __getitem__ (line 76) | def __getitem__(self, index): class TransformedDataset (line 90) | class TransformedDataset(Dataset): method __init__ (line 94) | def __init__(self, original_dataset, transform=None, target_transform=... method __len__ (line 100) | def __len__(self): method __getitem__ (line 103) | def __getitem__(self, index): class UnNormalize (line 113) | class UnNormalize(object): method __init__ (line 114) | def __init__(self, mean, std): method __call__ (line 118) | def __call__(self, tensor): FILE: examples/Structural_Development/DSD-SNN/cifar100/maskcl2.py function unit (line 7) | def unit(x): class Mask (line 23) | class Mask: method __init__ (line 24) | def __init__(self, model): method init_length (line 44) | def init_length(self): method get_filter_codebook (line 72) | def get_filter_codebook(self,index,ww,task,epoch): method convert2tensor (line 124) | def convert2tensor(self, x): method init_mask (line 128) | def init_mask(self,task,epoch): method do_mask (line 133) | def do_mask(self,task): method init_grow (line 140) | def init_grow(self,task): method if_zero (line 188) | def if_zero(self): method record (line 202) | def record(self): FILE: examples/Structural_Development/DSD-SNN/cifar100/vgg_snn.py class SNN (line 22) | class SNN(BaseModule): method __init__ (line 23) | def __init__(self, method logits (line 80) | def logits(self, x): method _create_decision (line 87) | def _create_decision(self): method forward (line 92) | def forward(self, inputs, mat): FILE: examples/Structural_Development/ELSM/evolve.py function _parse_args (line 37) | def _parse_args(): class Evolve (line 44) | class Evolve(Problem): method __init__ (line 46) | def __init__(self, args,n_var=20, n_obj=1, n_constr=0, lb=None, ub=None): method _evaluate (line 54) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 100) | def do_every_generations(algorithm): FILE: examples/Structural_Development/ELSM/lsm.py function lr_scheduler (line 21) | def lr_scheduler(optimizer, epoch, init_lr=0.1, lr_decay_epoch=50): FILE: examples/Structural_Development/ELSM/model.py class nSNN (line 20) | class nSNN(BaseModule): method __init__ (line 21) | def __init__(self, method forward (line 61) | def forward(self, x): class mSNN (line 79) | class mSNN(BaseModule): method __init__ (line 80) | def __init__(self, method forward (line 122) | def forward(self, x): FILE: examples/Structural_Development/ELSM/nsganet.py class NSGANet (line 24) | class NSGANet(GeneticAlgorithm): method __init__ (line 26) | def __init__(self, **kwargs): function binary_tournament (line 39) | def binary_tournament(pop, P, algorithm, **kwargs): class RankAndCrowdingSurvival (line 84) | class RankAndCrowdingSurvival(Survival): method __init__ (line 86) | def __init__(self) -> None: method _do (line 89) | def _do(self, pop, n_survive, D=None, **kwargs): function calc_crowding_distance (line 125) | def calc_crowding_distance(F): function nsganet (line 179) | def nsganet( FILE: examples/Structural_Development/ELSM/spikes.py function randbool (line 21) | def randbool(size, p=0.5): function calc_f2 (line 24) | def calc_f2(con,device): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/classifier.py class CosineClassifier (line 9) | class CosineClassifier(Module): method __init__ (line 10) | def __init__(self, in_features, n_classes, sigma=True): method reset_parameters (line 21) | def reset_parameters(self): method forward (line 27) | def forward(self, input): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/imbalance.py class BiC (line 7) | class BiC(nn.Module): method __init__ (line 8) | def __init__(self, lr, scheduling, lr_decay_factor, weight_decay, batc... method reset (line 21) | def reset(self, lr=None, scheduling=None, lr_decay_factor=None, weight... method extract_preds_and_targets (line 42) | def extract_preds_and_targets(self, model, loader,taski,mask): method update (line 50) | def update(self, logger, task_size, model, loader, loss_criterion=None... method post_process (line 98) | def post_process(self, preds, task_size): class CR (line 108) | class CR(object): method __init__ (line 109) | def __init__(self): method update (line 113) | def update(self, classifier, task_size): method post_process (line 122) | def post_process(self, logits, task_size): class All_av (line 127) | class All_av(object): method __init__ (line 128) | def __init__(self): method update (line 132) | def update(self, classifier, task_size, classnum_list, taski): method post_process (line 142) | def post_process(self, logits, task_size, classnum_list, taski): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/maskcl2.py function unit (line 8) | def unit(x): class Mask (line 24) | class Mask: method __init__ (line 25) | def __init__(self, model): method init_length (line 49) | def init_length(self,task=0,task_nn=None): method get_filter_reuse (line 74) | def get_filter_reuse(self,index,ww,task,epoch,c_index,cdim_before=None... method convert2tensor (line 106) | def convert2tensor(self, x): method init_mask (line 110) | def init_mask(self,task,epoch,dim_cur=None,task_nn=None,all_dist=None,... method do_mask (line 138) | def do_mask(self,task): method if_zero (line 145) | def if_zero(self): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/network.py class BasicNet (line 16) | class BasicNet(nn.Module): method __init__ (line 17) | def __init__( method forward (line 107) | def forward(self, task,inputs,mask=None,classify=True): method caculate_dim (line 217) | def caculate_dim(self, x): method features_dim (line 232) | def features_dim(self,ntask): method freeze (line 238) | def freeze(self): method copy (line 244) | def copy(self): method add_classes (line 247) | def add_classes(self, n_classes,min_dist): method _add_classes_multi_fc (line 257) | def _add_classes_multi_fc(self, n_classes,min_dist): method _add_classes_single_fc (line 305) | def _add_classes_single_fc(self, n_classes): method _gen_classifier (line 321) | def _gen_classifier(self, in_features, n_classes): method resetsnn (line 335) | def resetsnn(self): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/resnet.py function conv3x3 (line 20) | def conv3x3(in_planes, out_planes, stride=1): function conv1x1 (line 25) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 30) | class BasicBlock(nn.Module): method __init__ (line 33) | def __init__(self, inplanes, planes, stride=1, downsample=None, remove... method forward (line 44) | def forward(self, x): class Bottleneck (line 63) | class Bottleneck(nn.Module): method __init__ (line 66) | def __init__(self, inplanes, planes, stride=1, downsample=None): method forward (line 78) | def forward(self, x): class ChannelAttention (line 101) | class ChannelAttention(nn.Module): method __init__ (line 102) | def __init__(self, in_planes, ratio=16): method forward (line 112) | def forward(self, x): class SpatialAttention (line 119) | class SpatialAttention(nn.Module): method __init__ (line 120) | def __init__(self, kernel_size=7): method forward (line 127) | def forward(self, x): class SEFeatureAt (line 134) | class SEFeatureAt(nn.Module): method __init__ (line 135) | def __init__(self, inplanes, type, at_res): method forward (line 150) | def forward(self, x): class ResNet (line 166) | class ResNet(nn.Module): method __init__ (line 167) | def __init__(self, method _make_layer (line 224) | def _make_layer(self, block, planes, blocks, remove_last_relu=False, s... method reset_bn (line 245) | def reset_bn(self): method forward (line 250) | def forward(self, x): function resnet18 (line 261) | def resnet18(pretrained=False, **kwargs): function resnet34 (line 271) | def resnet34(pretrained=False, **kwargs): function resnet50 (line 281) | def resnet50(pretrained=False, **kwargs): function resnet101 (line 291) | def resnet101(pretrained=False, **kwargs): function resnet152 (line 301) | def resnet152(pretrained=False, **kwargs): FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/sew_resnet.py function sew_function (line 31) | def sew_function(x: torch.Tensor, y: torch.Tensor, cnf:str): function conv3x3 (line 43) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 49) | def conv1x1(in_planes, out_planes, stride=1): class BasicBlock (line 54) | class BasicBlock(nn.Module): method __init__ (line 57) | def __init__(self, inplanes, planes, planes_cur,stride=1, downsample=N... method forward (line 75) | def forward(self, x): method extra_repr (line 89) | def extra_repr(self) -> str: class SEWResNet (line 94) | class SEWResNet(BaseModule): method __init__ (line 95) | def __init__(self, block, layers, c_dim=[64,128,256,512], cdim_cur=[],... method _make_layer (line 161) | def _make_layer(self, block, planes, planes_cur,blocks, stride=1, dila... method forward_init (line 186) | def forward_init(self, inputs): method forward_impl (line 195) | def forward_impl(self, inputs): function _sew_resnet (line 205) | def _sew_resnet(arch, block, layers, c_dim,cdim_cur,pretrained, progress... function sew_resnet18 (line 214) | def sew_resnet18(c_dim=[64,128,256,512],cdim_cur=[],pretrained=False, pr... FILE: examples/Structural_Development/SCA-SNN/inclearn/convnet/utils.py function finetune_last_layer (line 9) | def finetune_last_layer( function extract_features (line 84) | def extract_features(task_i,model, loader,mask=None): function calc_class_mean (line 98) | def calc_class_mean(network, loader, class_idx, metric): function update_classes_mean (line 109) | def update_classes_mean(network, inc_dataset, n_classes, task_size, shar... FILE: examples/Structural_Development/SCA-SNN/inclearn/datasets/data.py function get_data_folder (line 25) | def get_data_folder(data_folder, dataset_name): class IncrementalDataset (line 29) | class IncrementalDataset: method __init__ (line 30) | def __init__( method n_tasks (line 96) | def n_tasks(self): method new_task (line 99) | def new_task(self,task_i): method _get_cur_step_data_for_raw_data (line 144) | def _get_cur_step_data_for_raw_data(self, task_i): method _setup_data (line 171) | def _setup_data(self, dataset): method _setup_data_for_raw_data (line 195) | def _setup_data_for_raw_data(self, dataset, train_dataset, test_datase... method _split_per_class (line 235) | def _split_per_class(x, y, validation_split=0.0): method _map_new_class_index (line 266) | def _map_new_class_index(y, order): method _select (line 270) | def _select(self, task_i,x, y, low_range=0, high_range=0): method get_datainc_loader (line 285) | def get_datainc_loader(self, mode='train'): method get_custom_loader_from_memory (line 290) | def get_custom_loader_from_memory(self, class_indexes, mode="test"): method _get_loader (line 307) | def _get_loader(self, x, y, share_memory=None, shuffle=True, mode="tra... method get_custom_loader (line 345) | def get_custom_loader(self, class_indexes, mode="test", data_source="t... class DummyDataset (line 379) | class DummyDataset(torch.utils.data.Dataset): method __init__ (line 380) | def __init__(self, x, y, trsf, trsf_type, share_memory_=None, dataset_... method __len__ (line 395) | def __len__(self): method __getitem__ (line 401) | def __getitem__(self, idx): FILE: examples/Structural_Development/SCA-SNN/inclearn/datasets/dataset.py function get_datasets (line 13) | def get_datasets(dataset_names): function get_dataset (line 17) | def get_dataset(dataset_name): class DataHandler (line 28) | class DataHandler: class iCIFAR10 (line 35) | class iCIFAR10(DataHandler): method __init__ (line 50) | def __init__(self, data_folder, train, is_fine_label=False): method is_proc_inc_data (line 57) | def is_proc_inc_data(self): method class_order (line 61) | def class_order(cls, trial_i): class iCIFAR100 (line 65) | class iCIFAR100(iCIFAR10): method __init__ (line 92) | def __init__(self, data_folder, train, is_fine_label=False): method is_proc_inc_data (line 100) | def is_proc_inc_data(self): method class_order (line 104) | def class_order(cls, trial_i): class DataHandler (line 113) | class DataHandler: class iImageNet100 (line 120) | class iImageNet100(DataHandler): method __init__ (line 146) | def __init__(self, data_folder, train, is_fine_label=False): method is_proc_inc_data (line 158) | def is_proc_inc_data(self): method class_order (line 162) | def class_order(cls, trial_i): FILE: examples/Structural_Development/SCA-SNN/inclearn/models/base.py class IncrementalLearner (line 11) | class IncrementalLearner(abc.ABC): method __init__ (line 22) | def __init__(self, *args, **kwargs): method set_task_info (line 26) | def set_task_info(self, task, total_n_classes, increment, n_train_data... method before_task (line 35) | def before_task(self, taski, inc_dataset,mask,min_dist,all_dist): method train_task (line 40) | def train_task(self, task_i,train_loader, val_loader,mask,min_dist,all... method after_task (line 45) | def after_task(self, taski, inc_dataset,mask): method eval_task (line 50) | def eval_task(self, task_i,data_loader,mask): method get_memory (line 55) | def get_memory(self): method eval (line 58) | def eval(self): method train (line 61) | def train(self): method _before_task (line 64) | def _before_task(self, data_loader): method _train_task (line 67) | def _train_task(self, train_loader, val_loader): method _after_task (line 70) | def _after_task(self, data_loader): method _eval_task (line 73) | def _eval_task(self, data_loader): method _new_task_index (line 77) | def _new_task_index(self): method _memory_per_class (line 81) | def _memory_per_class(self): method _after_epoch (line 85) | def _after_epoch(self, epoch, avg_loss, train_new_accu, train_old_accu... method _validation (line 105) | def _validation(self, val_loader, epoch): FILE: examples/Structural_Development/SCA-SNN/inclearn/models/incmodel.py class IncModel (line 30) | class IncModel(IncrementalLearner): method __init__ (line 31) | def __init__(self, cfg, trial_i, _run, ex, tensorboard, inc_dataset): method eval (line 107) | def eval(self): method train (line 110) | def train(self): method _before_task (line 120) | def _before_task(self, taski, inc_dataset,mask,min_dist,all_dist): method set_optimizer (line 140) | def set_optimizer(self, lr=None): method _train_task (line 173) | def _train_task(self, task_i,train_loader, val_loader,mask,min_dist,al... method _forward_loss (line 287) | def _forward_loss(self, task_i,inputs, targets, old_classes, new_class... method cross_entropy (line 295) | def cross_entropy(self, outputs, targets, exp=1.0, size_average=True, ... method hcl (line 311) | def hcl(self, fstudent, fteacher, targets): method _compute_loss (line 365) | def _compute_loss(self, task_i, inputs, targets, outputs, old_classes,... method _after_task (line 427) | def _after_task(self, taski, inc_dataset,mask=None): method _eval_task (line 471) | def _eval_task(self,task_i, data_loader,mask): method _compute_accuracy_by_netout (line 494) | def _compute_accuracy_by_netout(self, task_i,data_loader,mask): method _compute_accuracy_by_ncm (line 530) | def _compute_accuracy_by_ncm(self, loader): method _update_postprocessor (line 543) | def _update_postprocessor(self, taski,inc_dataset,mask=None): method update_prototype (line 572) | def update_prototype(self): method build_exemplars (line 584) | def build_exemplars(self, task_i,inc_dataset, coreset_strategy,mask=No... method validate (line 623) | def validate(self, data_loader): method after_prune (line 631) | def after_prune(self, taski, inc_dataset): class DistillKL (line 651) | class DistillKL(nn.Module): method __init__ (line 653) | def __init__(self, T): method forward (line 657) | def forward(self, y_s, y_t): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/autoaugment_extra.py class ImageNetPolicy (line 6) | class ImageNetPolicy(object): method __init__ (line 17) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 165) | def __call__(self, img): method __repr__ (line 169) | def __repr__(self): class SubPolicy (line 173) | class SubPolicy(object): method __init__ (line 174) | def __init__(self, p1, operation1, magnitude_idx1, p2, operation2, mag... method __call__ (line 276) | def __call__(self, img): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/cutout.py class Cutout (line 4) | class Cutout(object): method __init__ (line 10) | def __init__(self, n_holes, length): method __call__ (line 14) | def __call__(self, img): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/data_utils.py function construct_balanced_subset (line 4) | def construct_balanced_subset(x, y): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/factory.py function get_optimizer (line 11) | def get_optimizer(params, optimizer, lr, weight_decay=0.0): function get_attention (line 19) | def get_attention(inplane, type, at_res): function get_convnet (line 22) | def get_convnet(convnet_type, c_dim=None,cdim_cur=None,**kwargs): function get_model (line 30) | def get_model(cfg, trial_i, _run, ex, tensorboard, inc_dataset): function get_data (line 37) | def get_data(cfg, trial_i): function set_device (line 54) | def set_device(cfg): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/memory.py class MemorySize (line 10) | class MemorySize: method __init__ (line 11) | def __init__(self, mode, inc_dataset, total_memory=None, fixed_memory_... method update_n_classes (line 20) | def update_n_classes(self, n_classes): method update_memory_per_cls_uniform (line 23) | def update_memory_per_cls_uniform(self, n_classes): method update_memory_per_cls (line 30) | def update_memory_per_cls(self, network, n_classes, task_size): method memsize (line 38) | def memsize(self): function compute_examplar_mean (line 45) | def compute_examplar_mean(feat_norm, feat_flip, herding_mat, nb_max): function select_examplars (line 65) | def select_examplars(features, nb_max): function random_selection (line 92) | def random_selection(n_classes, task_size, network, logger, inc_dataset,... function herding (line 112) | def herding(task_i,n_classes, task_size, network, herding_matrix, inc_da... FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/metrics.py class IncConfusionMeter (line 7) | class IncConfusionMeter: method __init__ (line 17) | def __init__(self, k, increments, normalized=False): method reset (line 25) | def reset(self): method add (line 28) | def add(self, predicted, target): method value (line 75) | def value(self): class ClassErrorMeter (line 99) | class ClassErrorMeter: method __init__ (line 100) | def __init__(self, topk=[1], accuracy=False): method reset (line 106) | def reset(self): method add (line 110) | def add(self, output, target): method value (line 143) | def value(self, k=-1): class AverageValueMeter (line 157) | class AverageValueMeter: method __init__ (line 158) | def __init__(self): method add (line 163) | def add(self, value, n=1): method value (line 181) | def value(self): method reset (line 184) | def reset(self): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/results_utils.py function get_template_results (line 12) | def get_template_results(cfg): function save_results (line 16) | def save_results(results, label): function compute_avg_inc_acc (line 28) | def compute_avg_inc_acc(results): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/scheduler.py class ConstantTaskLR (line 6) | class ConstantTaskLR: method __init__ (line 7) | def __init__(self, lr): method get_lr (line 10) | def get_lr(self, task_i): class CosineAnnealTaskLR (line 14) | class CosineAnnealTaskLR: method __init__ (line 15) | def __init__(self, lr_max, lr_min, task_max): method get_lr (line 20) | def get_lr(self, task_i): class GradualWarmupScheduler (line 24) | class GradualWarmupScheduler(_LRScheduler): method __init__ (line 34) | def __init__(self, optimizer, multiplier, total_epoch, after_scheduler... method get_lr (line 43) | def get_lr(self): method step_ReduceLROnPlateau (line 60) | def step_ReduceLROnPlateau(self, metrics, epoch=None): method step (line 77) | def step(self, epoch=None, metrics=None): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/similar.py class Appr (line 9) | class Appr(object): method __init__ (line 11) | def __init__(self, pretrained_feat_extractor, num_task, torc,device='c... method get_mean_cov_feats (line 29) | def get_mean_cov_feats(self, taski, data, device): method after_get_mean_cov_feats (line 79) | def after_get_mean_cov_feats(self, taski, data, device): method add_mean_cov (line 120) | def add_mean_cov(self, taski,mean, cov=None): method task_relatedness_knnkl (line 124) | def task_relatedness_knnkl(self, task_id, p_task_id, all_feats): method get_relatedness (line 172) | def get_relatedness(self, task_id, feats): method strategy (line 191) | def strategy(self, task_id, num_train_samples): method learn (line 236) | def learn(self, task_id, valid_data, batch_size,device): method after_learn (line 264) | def after_learn(self, task_id, valid_data, batch_size,device): class ResNet_FE (line 275) | class ResNet_FE(nn.Module): method __init__ (line 280) | def __init__(self, resnet_model): method forward (line 286) | def forward(self, x): function get_pretrained_feat_extractor (line 289) | def get_pretrained_feat_extractor(name): function gaussian_mean_cov (line 301) | def gaussian_mean_cov(X): FILE: examples/Structural_Development/SCA-SNN/inclearn/tools/utils.py function get_date (line 12) | def get_date(): function to_onehot (line 16) | def to_onehot(targets, n_classes): function get_class_loss (line 24) | def get_class_loss(network, cur_n_cls, loader): function get_featnorm_grouped_by_class (line 41) | def get_featnorm_grouped_by_class(task_i,network, cur_n_cls, loader,m=No... function set_seed (line 64) | def set_seed(seed): function display_weight_norm (line 74) | def display_weight_norm(logger, network, increments, tag): function display_feature_norm (line 93) | def display_feature_norm(task_i,logger, network, loader, n_classes, incr... function check_loss (line 112) | def check_loss(loss): function class2task (line 115) | def class2task(class_form, classnum): function maskclass (line 123) | def maskclass(pred, target, classnum, type='new'): function compute_old_new_mix (line 163) | def compute_old_new_mix(ypred, ytrue, increments, n_classes, task_order): function compute_task_accuracy (line 196) | def compute_task_accuracy(ypred, ytrue, increments, n_classes, task_order): function compute_accuracy (line 208) | def compute_accuracy(ypred, ytrue, increments, n_classes): function make_logger (line 248) | def make_logger(log_name, savedir='.logs/'): FILE: examples/Structural_Development/SCA-SNN/main.py function initialization (line 36) | def initialization(config, seed, mode, exp_id): function train (line 61) | def train(_run, _rnd, _seed): function _train (line 71) | def _train(cfg, _run, ex, tensorboard): FILE: examples/Structural_Development/SD-SNN/main.py function train_epoch (line 90) | def train_epoch( function validate (line 138) | def validate(model, loader, loss_fn, amp_autocast=suppress, log_suffix=''): FILE: examples/Structural_Development/SD-SNN/prun_and_generation.py class Mask (line 7) | class Mask: method __init__ (line 8) | def __init__(self, model,count_thre): method convert2tensor (line 58) | def convert2tensor(self, x): method init_length (line 62) | def init_length(self): method init_mask_dsd (line 110) | def init_mask_dsd(self): method get_range_weight (line 120) | def get_range_weight(self, weight_torch, length, i, count_thre): method do_mask_dsd (line 183) | def do_mask_dsd(self): method do_pruning_dsd (line 198) | def do_pruning_dsd(self,epoch): method cal_prune (line 238) | def cal_prune(self,index,epoch): method do_growth_ww (line 262) | def do_growth_ww(self,epoch): method if_zero (line 319) | def if_zero(self): FILE: examples/Structural_Development/SD-SNN/snn_model.py class my_cifar_model (line 13) | class my_cifar_model(BaseModule): method __init__ (line 14) | def __init__(self, method _cflatten (line 42) | def _cflatten(self): method _create_fc_prun (line 48) | def _create_fc_prun(self): method _create_fc (line 54) | def _create_fc(self): method forward (line 60) | def forward(self, inputs): FILE: examples/Structural_Development/SD-SNN/utils.py function unit (line 5) | def unit(x): function unit_tensor (line 19) | def unit_tensor(x): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/brid.py function randbool (line 25) | def randbool(size, p): class Evolve (line 28) | class Evolve(Problem): method __init__ (line 30) | def __init__(self, n_var=20, n_obj=1, n_constr=0, lb=None, ub=None): method _evaluate (line 37) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 54) | def do_every_generations(algorithm): function load_images (line 68) | def load_images(): class Bird (line 90) | class Bird(pygame.sprite.Sprite): method __init__ (line 103) | def __init__(self, x, y, msec_to_climb, images): method update (line 111) | def update(self, action, state, delta_frames=1): method sink (line 130) | def sink(self, delta_frames=1): method image (line 134) | def image(self): method mask (line 141) | def mask(self): method rect (line 148) | def rect(self): class PipePair (line 152) | class PipePair(pygame.sprite.Sprite): method __init__ (line 162) | def __init__(self, pipe_end_img, pipe_body_img): method top_height_px (line 205) | def top_height_px(self): method bottom_height_px (line 209) | def bottom_height_px(self): method visible (line 213) | def visible(self): method rect (line 217) | def rect(self): method update (line 220) | def update(self, delta_frames=1): method collides_with (line 223) | def collides_with(self, bird): function judgeState (line 227) | def judgeState(bird, pipes, collide): function blankState (line 278) | def blankState(bird, center): function getReward (line 305) | def getReward(state, lastState, smallerError, isNewPipe): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/lsmmodel.py class SNN (line 20) | class SNN(BaseModule): method __init__ (line 21) | def __init__(self, method forward (line 64) | def forward(self, x): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/maze.py function randbool (line 20) | def randbool(size, p): class Evolve (line 23) | class Evolve(Problem): method __init__ (line 25) | def __init__(self, n_var=20, n_obj=1, n_constr=0, lb=None, ub=None): method _evaluate (line 32) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 48) | def do_every_generations(algorithm): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/tools/EnuGlobalNetwork.py class EnuGlobalNetwork (line 17) | class EnuGlobalNetwork(AbstractLayerBMM): method __init__ (line 20) | def __init__(self, n_offspring, n_pseudo_env, n_input_neurons, n_hidde... method dump_model (line 140) | def dump_model(self, e, exp_name): method restore_model (line 148) | def restore_model(self, e, exp_name): method plot_weights (line 161) | def plot_weights(e, exp_name): method dump_network_activity (line 192) | def dump_network_activity(self, e, exp_name): method print (line 197) | def print(self): method reset (line 203) | def reset(self): method forward (line 210) | def forward(self, X): method _track_vis_data (line 244) | def _track_vis_data(self, X, input_to_synapses_connected, input_to_neu... method plot_network_activity (line 250) | def plot_network_activity(e, exp_name): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/tools/ExperimentEnvGlobalNetworkSurvival.py class ExperimentEnvGlobalNetworkSurvival (line 8) | class ExperimentEnvGlobalNetworkSurvival: method __init__ (line 13) | def __init__(self, env, exp_name='maze'): method _convert_obs (line 21) | def _convert_obs(self, obs, rewards): method _convert_reward (line 33) | def _convert_reward(self, obs, actions, rewards, infos, dones): method step (line 42) | def step(self, y): method reset (line 64) | def reset(self): method render (line 78) | def render(self): method track_vis_data (line 82) | def track_vis_data(self, vis_data, model, X, y_est, t): method dump_vis_data (line 87) | def dump_vis_data(self, vis_data, fitness_per_offspring, e): method load_vis_data (line 92) | def load_vis_data(e, exp_name): method plot_vis_data (line 98) | def plot_vis_data(e, exp_name): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/tools/MazeTurnEnvVec.py class MazeTurnEnvVec (line 11) | class MazeTurnEnvVec: method __init__ (line 15) | def __init__(self, n_agents, n_steps): method step (line 33) | def step(self, actions): method _reset_pos (line 98) | def _reset_pos(self, idxs): method _reset_pos_pois (line 106) | def _reset_pos_pois(self, idxs): method _reset_food (line 111) | def _reset_food(self, idxs, prob=0.5): method reset (line 124) | def reset(self): method _get_obs_from_pos (line 167) | def _get_obs_from_pos(self): method render (line 209) | def render(self): method load_vis_data (line 247) | def load_vis_data(e, exp_name): method plot_vis_data (line 253) | def plot_vis_data(e, exp_name): method plot_rollout_data (line 302) | def plot_rollout_data(e, exp_name): FILE: examples/Structure_Evolution/Adaptive_lsm/BrainCog-Version/tools/nsganet.py class NSGANet (line 24) | class NSGANet(GeneticAlgorithm): method __init__ (line 26) | def __init__(self, **kwargs): function binary_tournament (line 39) | def binary_tournament(pop, P, algorithm, **kwargs): class RankAndCrowdingSurvival (line 84) | class RankAndCrowdingSurvival(Survival): method __init__ (line 86) | def __init__(self) -> None: method _do (line 89) | def _do(self, pop, n_survive, D=None, **kwargs): function calc_crowding_distance (line 125) | def calc_crowding_distance(F): function nsganet (line 179) | def nsganet( FILE: examples/Structure_Evolution/Adaptive_lsm/raw/BCM.py function randbool (line 47) | def randbool(size, p): function fit (line 51) | def fit(agent): class SNN (line 68) | class SNN(BaseModule): method __init__ (line 69) | def __init__(self, method forward (line 108) | def forward(self, x): class REINFORCE (line 125) | class REINFORCE: method __init__ (line 126) | def __init__(self, lm): method select_action (line 131) | def select_action(self, state): class Evolve (line 143) | class Evolve(Problem): method __init__ (line 145) | def __init__(self, n_var=20, n_obj=1, n_constr=0, lb=None, ub=None): method _evaluate (line 152) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 196) | def do_every_generations(algorithm): FILE: examples/Structure_Evolution/Adaptive_lsm/raw/lstm.py class Policy (line 41) | class Policy(nn.Module): method __init__ (line 42) | def __init__(self, hidden_size, s_dim, a_dim): method forward (line 49) | def forward(self, x,hidden): class REINFORCE (line 55) | class REINFORCE: method __init__ (line 56) | def __init__(self, hidden_size, s_dim, a_dim): method select_action (line 63) | def select_action(self, state,hx,cx): method update_parameters (line 74) | def update_parameters(self, rewards, log_probs, entropies, gamma):# 更新参数 FILE: examples/Structure_Evolution/Adaptive_lsm/raw/main.py class Policy (line 40) | class Policy(nn.Module): method __init__ (line 41) | def __init__(self, hidden_size, s_dim, a_dim): method forward (line 48) | def forward(self, x): class REINFORCE (line 53) | class REINFORCE: method __init__ (line 54) | def __init__(self, hidden_size, s_dim, a_dim): method select_action (line 62) | def select_action(self, state): method update_parameters (line 73) | def update_parameters(self, rewards, log_probs, entropies, gamma): FILE: examples/Structure_Evolution/Adaptive_lsm/raw/q_l.py class Agent (line 11) | class Agent(object): method __init__ (line 16) | def __init__(self, env,alpha=0.1, gamma=0.9): method choose_action (line 25) | def choose_action(self,state,epsilon=0.8): method update_q_value (line 40) | def update_q_value(self, state, action, next_state_reward, next_state_... method add_state (line 44) | def add_state(self,X_next): method learn (line 51) | def learn(self, env, episode=100, epsilon=0.8): method play (line 73) | def play(self, env): function QQ (line 108) | def QQ(): FILE: examples/Structure_Evolution/Adaptive_lsm/raw/tools/EnuGlobalNetwork.py class EnuGlobalNetwork (line 17) | class EnuGlobalNetwork(AbstractLayerBMM): method __init__ (line 20) | def __init__(self, n_offspring, n_pseudo_env, n_input_neurons, n_hidde... method dump_model (line 140) | def dump_model(self, e, exp_name): method restore_model (line 148) | def restore_model(self, e, exp_name): method plot_weights (line 161) | def plot_weights(e, exp_name): method dump_network_activity (line 192) | def dump_network_activity(self, e, exp_name): method print (line 197) | def print(self): method reset (line 203) | def reset(self): method forward (line 210) | def forward(self, X): method _track_vis_data (line 244) | def _track_vis_data(self, X, input_to_synapses_connected, input_to_neu... method plot_network_activity (line 250) | def plot_network_activity(e, exp_name): FILE: examples/Structure_Evolution/Adaptive_lsm/raw/tools/ExperimentEnvGlobalNetworkSurvival.py class ExperimentEnvGlobalNetworkSurvival (line 8) | class ExperimentEnvGlobalNetworkSurvival: method __init__ (line 13) | def __init__(self, env, exp_name='maze'): method _convert_obs (line 21) | def _convert_obs(self, obs, rewards): method _convert_reward (line 33) | def _convert_reward(self, obs, actions, rewards, infos, dones): method step (line 42) | def step(self, y): method reset (line 64) | def reset(self): method render (line 78) | def render(self): method track_vis_data (line 82) | def track_vis_data(self, vis_data, model, X, y_est, t): method dump_vis_data (line 87) | def dump_vis_data(self, vis_data, fitness_per_offspring, e): method load_vis_data (line 92) | def load_vis_data(e, exp_name): method plot_vis_data (line 98) | def plot_vis_data(e, exp_name): FILE: examples/Structure_Evolution/Adaptive_lsm/raw/tools/MazeTurnEnvVec.py class MazeTurnEnvVec (line 11) | class MazeTurnEnvVec: method __init__ (line 15) | def __init__(self, n_agents, n_steps): method step (line 33) | def step(self, actions): method _reset_pos (line 98) | def _reset_pos(self, idxs): method _reset_pos_pois (line 106) | def _reset_pos_pois(self, idxs): method _reset_food (line 111) | def _reset_food(self, idxs, prob=0.5): method reset (line 124) | def reset(self): method _get_obs_from_pos (line 167) | def _get_obs_from_pos(self): method render (line 209) | def render(self): method load_vis_data (line 247) | def load_vis_data(e, exp_name): method plot_vis_data (line 253) | def plot_vis_data(e, exp_name): method plot_rollout_data (line 302) | def plot_rollout_data(e, exp_name): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/adaptive_switching.py class AdaptiveSwitching (line 6) | class AdaptiveSwitching: method __init__ (line 9) | def __init__(self, n_fold=10): method fit (line 17) | def fit(self, train_data, train_target): method _n_fold_validation (line 22) | def _n_fold_validation(self, train_data, train_target, n=10): method predict (line 56) | def predict(self, test_data): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/carts.py class CART (line 8) | class CART: method __init__ (line 10) | def __init__(self, n_tree=1000): method _make_decision_trees (line 16) | def _make_decision_trees(train_data, train_label, n_tree): method fit (line 38) | def fit(self, train_data, train_label): method predict (line 41) | def predict(self, test_data): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/factory.py function get_acc_predictor (line 1) | def get_acc_predictor(model, inputs, targets): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/gp.py class GP (line 6) | class GP: method __init__ (line 8) | def __init__(self, regr='linear', corr='gauss'): method fit (line 14) | def fit(self, train_data, train_label): method predict (line 43) | def predict(self, test_data): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/mlp.py class Net (line 8) | class Net(nn.Module): method __init__ (line 10) | def __init__(self, n_feature, n_layers=2, n_hidden=300, n_output=1, dr... method forward (line 24) | def forward(self, x): method init_weights (line 32) | def init_weights(m): class MLP (line 40) | class MLP: method __init__ (line 42) | def __init__(self, **kwargs): method fit (line 46) | def fit(self, **kwargs): method predict (line 49) | def predict(self, test_data, device='cpu'): function train (line 53) | def train(net, x, y, trn_split=0.8, pretrained=None, device='cpu', function train_one_epoch (line 104) | def train_one_epoch(net, data, target, criterion, optimizer, device): function infer (line 117) | def infer(net, data, target, criterion, device): function validate (line 128) | def validate(net, data, target, device): function predict (line 142) | def predict(net, query, device): FILE: examples/Structure_Evolution/EB-NAS/acc_predictor/rbf.py class RBF (line 4) | class RBF: method __init__ (line 7) | def __init__(self, kernel='cubic', tail='linear'): method fit (line 13) | def fit(self, train_data, train_label): method predict (line 33) | def predict(self, test_data): FILE: examples/Structure_Evolution/EB-NAS/cellmodel.py class EvoCell2 (line 15) | class EvoCell2(nn.Module): method __init__ (line 16) | def __init__(self,motif, C_prev_prev, C_prev, C, reduction, reduction_... method _compile (line 41) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 74) | def forward(self, s0, s1, drop_prob): class EvoCell3 (line 115) | class EvoCell3(nn.Module): method __init__ (line 116) | def __init__(self,motif, C_prev_prev_prev, C_prev_prev, C_prev, C, red... method _compile (line 149) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 182) | def forward(self, s0, s1, s2, drop_prob): class EvoCell4 (line 230) | class EvoCell4(nn.Module): method __init__ (line 231) | def __init__(self,motif, C_prev_prev_prev_prev,C_prev_prev_prev, C_pre... method _compile (line 277) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 310) | def forward(self, s0, s1, s2, s3, drop_prob): class NetworkCIFAR (line 371) | class NetworkCIFAR(BaseModule): method __init__ (line 373) | def __init__(self, method forward (line 492) | def forward(self, inputs): class NetworkCIFAR_ (line 563) | class NetworkCIFAR_(BaseModule): method __init__ (line 565) | def __init__(self, method forward (line 660) | def forward(self, inputs): function occumpy_mem (line 735) | def occumpy_mem(cuda_device): FILE: examples/Structure_Evolution/EB-NAS/ebnas.py class NAS (line 368) | class NAS(Problem): method __init__ (line 370) | def __init__(self, args,n_var=20, n_obj=1, n_constr=0, lb=None, ub=None, method _evaluate (line 379) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 403) | def do_every_generations(algorithm): function _parse_args (line 418) | def _parse_args(): FILE: examples/Structure_Evolution/EB-NAS/micro_encoding.py function convert_cell (line 82) | def convert_cell(cell_bit_string): function filt (line 87) | def filt(sn): function shuffle_along_axis (line 100) | def shuffle_along_axis(a, axis): function sample (line 104) | def sample(pops, layers, bits , ): function reencode (line 125) | def reencode(sn,bigmotifs,pops): function convert (line 132) | def convert(mgenome, layers, bits): function convert_single (line 141) | def convert_single(mgenome, layers, bits): function c_single (line 149) | def c_single(mgenome, layers, bits): function decode (line 173) | def decode(genome): function decode_motif (line 198) | def decode_motif(layers,bits,genome): function compare_cell (line 232) | def compare_cell(cell_string1, cell_string2): function compare (line 248) | def compare(string1, string2): FILE: examples/Structure_Evolution/EB-NAS/nsganet.py class NSGANet (line 23) | class NSGANet(GeneticAlgorithm): method __init__ (line 25) | def __init__(self, **kwargs): function binary_tournament (line 38) | def binary_tournament(pop, P, algorithm, **kwargs): class RankAndCrowdingSurvival (line 83) | class RankAndCrowdingSurvival(Survival): method __init__ (line 85) | def __init__(self) -> None: method _do (line 88) | def _do(self, pop, n_survive, D=None, **kwargs): function calc_crowding_distance (line 124) | def calc_crowding_distance(F): function nsganet (line 178) | def nsganet( FILE: examples/Structure_Evolution/EB-NAS/operations.py function si_relu (line 15) | def si_relu(x, positive): class SiReLU (line 27) | class SiReLU(nn.Module): method __init__ (line 28) | def __init__(self, positive=0): method forward (line 32) | def forward(self, x): function weight_init (line 36) | def weight_init(m): class SiMLP (line 157) | class SiMLP(nn.Module): method __init__ (line 158) | def __init__(self, c_in, c_out, act_fun=nn.ReLU, positive=0, *args, **... method forward (line 166) | def forward(self, x): class DilConv (line 173) | class DilConv(nn.Module): method __init__ (line 178) | def __init__(self, C_in, C_out, kernel_size, stride, padding, dilation... method forward (line 192) | def forward(self, x): class SepConv (line 197) | class SepConv(nn.Module): method __init__ (line 199) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 218) | def forward(self, x): class Identity (line 223) | class Identity(nn.Module): method __init__ (line 225) | def __init__(self, positive=0): method forward (line 229) | def forward(self, x): class Zero (line 233) | class Zero(nn.Module): method __init__ (line 235) | def __init__(self, stride): method forward (line 239) | def forward(self, x): class FactorizedReduce (line 245) | class FactorizedReduce(nn.Module): method __init__ (line 247) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 259) | def forward(self, x): class F0 (line 267) | class F0(nn.Module): method __init__ (line 269) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 282) | def forward(self, x): class F1 (line 291) | class F1(nn.Module): method __init__ (line 293) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 306) | def forward(self, x): class ReLUConvBN (line 315) | class ReLUConvBN(nn.Module): method __init__ (line 320) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 333) | def forward(self, x): class Attention (line 357) | class Attention(Module): method __init__ (line 362) | def __init__(self, dim, num_heads=4, attention_dropout=0.1, projection... method forward (line 373) | def forward(self, x): class TransformerEncoderLayer (line 389) | class TransformerEncoderLayer(Module): method __init__ (line 395) | def __init__(self, d_model, nhead=4, dim_feedforward=256, dropout=0.1, method forward (line 413) | def forward(self, src: torch.Tensor, *args, **kwargs) -> torch.Tensor: function drop_path (line 426) | def drop_path(x, drop_prob: float = 0., training: bool = False): class DropPath (line 448) | class DropPath(Module): method __init__ (line 454) | def __init__(self, drop_prob=None): method forward (line 458) | def forward(self, x): FILE: examples/Structure_Evolution/EB-NAS/single_genome.py function _parse_args (line 353) | def _parse_args(): FILE: examples/Structure_Evolution/EB-NAS/tm.py function train_motifs (line 43) | def train_motifs(args,gen,arch_dir,genome,_logger,args_text,devices,ms,g... function train_epoch (line 417) | def train_epoch( function validate (line 615) | def validate(epoch, model, loader, loss_fn, args, arch_dir,_logger,amp_a... function get_net_info (line 810) | def get_net_info(args, gen,genome,ms): FILE: examples/Structure_Evolution/ELSM/evolve.py function _parse_args (line 40) | def _parse_args(): function calc_f1 (line 45) | def calc_f1(dirs): function mul_f1 (line 60) | def mul_f1(pop,steps,rootdir): class Evolve (line 72) | class Evolve(Problem): method __init__ (line 74) | def __init__(self, args,n_var=20, n_obj=1, n_constr=0, lb=None, ub=None): method _evaluate (line 82) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 128) | def do_every_generations(algorithm): FILE: examples/Structure_Evolution/ELSM/lsm.py function lr_scheduler (line 21) | def lr_scheduler(optimizer, epoch, init_lr=0.1, lr_decay_epoch=50): class LabelSmoothingBCEWithLogitsLoss (line 59) | class LabelSmoothingBCEWithLogitsLoss(nn.Module): method __init__ (line 61) | def __init__(self, smoothing=0.1): method forward (line 72) | def forward(self, x, target): FILE: examples/Structure_Evolution/ELSM/model.py class nSNN (line 20) | class nSNN(BaseModule): method __init__ (line 21) | def __init__(self, method forward (line 61) | def forward(self, x): class mSNN (line 79) | class mSNN(BaseModule): method __init__ (line 80) | def __init__(self, method forward (line 122) | def forward(self, x): FILE: examples/Structure_Evolution/ELSM/nsganet.py class NSGANet (line 24) | class NSGANet(GeneticAlgorithm): method __init__ (line 26) | def __init__(self, **kwargs): function binary_tournament (line 39) | def binary_tournament(pop, P, algorithm, **kwargs): class RankAndCrowdingSurvival (line 84) | class RankAndCrowdingSurvival(Survival): method __init__ (line 86) | def __init__(self) -> None: method _do (line 89) | def _do(self, pop, n_survive, D=None, **kwargs): function calc_crowding_distance (line 125) | def calc_crowding_distance(F): function nsganet (line 179) | def nsganet( FILE: examples/Structure_Evolution/ELSM/spikes.py function randbool (line 21) | def randbool(size, p=0.5): function calc_f2 (line 24) | def calc_f2(con,device): FILE: examples/Structure_Evolution/MSE-NAS/auto_augment.py class ImageNetPolicy (line 14) | class ImageNetPolicy(object): method __init__ (line 28) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 60) | def __call__(self, img): method __repr__ (line 64) | def __repr__(self): class CIFAR10Policy (line 68) | class CIFAR10Policy(object): method __init__ (line 82) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 114) | def __call__(self, img): method __repr__ (line 118) | def __repr__(self): class SVHNPolicy (line 122) | class SVHNPolicy(object): method __init__ (line 136) | def __init__(self, fillcolor=(128, 128, 128)): method __call__ (line 168) | def __call__(self, img): method __repr__ (line 172) | def __repr__(self): class SubPolicy (line 176) | class SubPolicy(object): method __init__ (line 178) | def __init__(self, method __call__ (line 269) | def __call__(self, img): FILE: examples/Structure_Evolution/MSE-NAS/cellmodel.py class EvoCell2 (line 15) | class EvoCell2(nn.Module): method __init__ (line 16) | def __init__(self,motif, C_prev_prev, C_prev, C, reduction, reduction_... method _compile (line 41) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 74) | def forward(self, s0, s1, drop_prob): class EvoCell3 (line 115) | class EvoCell3(nn.Module): method __init__ (line 116) | def __init__(self,motif, C_prev_prev_prev, C_prev_prev, C_prev, C, red... method _compile (line 149) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 182) | def forward(self, s0, s1, s2, drop_prob): class EvoCell4 (line 230) | class EvoCell4(nn.Module): method __init__ (line 231) | def __init__(self,motif, C_prev_prev_prev_prev,C_prev_prev_prev, C_pre... method _compile (line 277) | def _compile(self, C, op_names, indices, concat, reduction): method forward (line 310) | def forward(self, s0, s1, s2, s3, drop_prob): class NetworkCIFAR (line 371) | class NetworkCIFAR(BaseModule): method __init__ (line 373) | def __init__(self, method forward (line 493) | def forward(self, inputs): class NetworkImageNet (line 588) | class NetworkImageNet(BaseModule): method __init__ (line 590) | def __init__(self, method forward (line 662) | def forward(self, inputs): FILE: examples/Structure_Evolution/MSE-NAS/evolution.py function check_mem (line 368) | def check_mem(cuda_device): function occumpy_mem (line 373) | def occumpy_mem(cuda_device): class NAS (line 383) | class NAS(Problem): method __init__ (line 385) | def __init__(self, args,n_var=20, n_obj=1, n_constr=0, lb=None, ub=None, method _evaluate (line 394) | def _evaluate(self, x, out, *args, **kwargs): function do_every_generations (line 441) | def do_every_generations(algorithm): function _parse_args (line 456) | def _parse_args(): FILE: examples/Structure_Evolution/MSE-NAS/loss_f.py function psp (line 5) | def psp(inputs, n_steps,tau_s): class SpikeLoss (line 20) | class SpikeLoss(torch.nn.Module): method __init__ (line 24) | def __init__(self, desired_count,undesired_count): method spike_count (line 30) | def spike_count(self, outputs, target, desired_count,undesired_count): method spike_kernel (line 34) | def spike_kernel(self, outputs, target, desired_count,undesired_count): method spike_soft_max (line 38) | def spike_soft_max(self, outputs, target): class loss_count (line 43) | class loss_count(torch.autograd.Function): # a and u is the incremnet o... method forward (line 45) | def forward(ctx, outputs, target, desired_count,undesired_count): method backward (line 65) | def backward(ctx, grad): class loss_kernel (line 69) | class loss_kernel(torch.autograd.Function): # a and u is the incremnet ... method forward (line 71) | def forward(ctx, outputs, target, n_steps,tau_s): method backward (line 78) | def backward(ctx, grad): FILE: examples/Structure_Evolution/MSE-NAS/micro_encoding.py function convert_cell (line 73) | def convert_cell(cell_bit_string): function convert (line 79) | def convert(bit_string): function decode (line 101) | def decode(genome): function decode_motif (line 126) | def decode_motif(layers,bits,genome): function compare_cell (line 163) | def compare_cell(cell_string1, cell_string2): function compare (line 179) | def compare(string1, string2): FILE: examples/Structure_Evolution/MSE-NAS/nsganet.py class NSGANet (line 23) | class NSGANet(GeneticAlgorithm): method __init__ (line 25) | def __init__(self, **kwargs): function binary_tournament (line 38) | def binary_tournament(pop, P, algorithm, **kwargs): class RankAndCrowdingSurvival (line 83) | class RankAndCrowdingSurvival(Survival): method __init__ (line 85) | def __init__(self) -> None: method _do (line 88) | def _do(self, pop, n_survive, D=None, **kwargs): function calc_crowding_distance (line 124) | def calc_crowding_distance(F): function nsganet (line 178) | def nsganet( FILE: examples/Structure_Evolution/MSE-NAS/obj.py function logdet (line 30) | def logdet(K): function LSP (line 35) | def LSP(args,genome,train_data): FILE: examples/Structure_Evolution/MSE-NAS/operations.py function si_relu (line 15) | def si_relu(x, positive): class SiReLU (line 27) | class SiReLU(nn.Module): method __init__ (line 28) | def __init__(self, positive=0): method forward (line 32) | def forward(self, x): function weight_init (line 36) | def weight_init(m): class SiMLP (line 157) | class SiMLP(nn.Module): method __init__ (line 158) | def __init__(self, c_in, c_out, act_fun=nn.ReLU, positive=0, *args, **... method forward (line 166) | def forward(self, x): class DilConv (line 173) | class DilConv(nn.Module): method __init__ (line 178) | def __init__(self, C_in, C_out, kernel_size, stride, padding, dilation... method forward (line 192) | def forward(self, x): class SepConv (line 197) | class SepConv(nn.Module): method __init__ (line 199) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 218) | def forward(self, x): class Identity (line 223) | class Identity(nn.Module): method __init__ (line 225) | def __init__(self, positive=0): method forward (line 229) | def forward(self, x): class Zero (line 233) | class Zero(nn.Module): method __init__ (line 235) | def __init__(self, stride): method forward (line 239) | def forward(self, x): class FactorizedReduce (line 245) | class FactorizedReduce(nn.Module): method __init__ (line 247) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 259) | def forward(self, x): class F0 (line 267) | class F0(nn.Module): method __init__ (line 269) | def __init__(self, C_in, C_out, affine=True, act_fun=nn.ReLU, positive... method forward (line 282) | def forward(self, x): class ReLUConvBN (line 292) | class ReLUConvBN(nn.Module): method __init__ (line 297) | def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=T... method forward (line 310) | def forward(self, x): class Attention (line 334) | class Attention(Module): method __init__ (line 339) | def __init__(self, dim, num_heads=4, attention_dropout=0.1, projection... method forward (line 350) | def forward(self, x): class TransformerEncoderLayer (line 366) | class TransformerEncoderLayer(Module): method __init__ (line 372) | def __init__(self, d_model, nhead=4, dim_feedforward=256, dropout=0.1, method forward (line 390) | def forward(self, src: torch.Tensor, *args, **kwargs) -> torch.Tensor: function drop_path (line 403) | def drop_path(x, drop_prob: float = 0., training: bool = False): class DropPath (line 425) | class DropPath(Module): method __init__ (line 431) | def __init__(self, drop_prob=None): method forward (line 435) | def forward(self, x): FILE: examples/Structure_Evolution/MSE-NAS/tm.py function train_motifs (line 44) | def train_motifs(args,gen,arch_dir,genome,_logger,args_text,devices,bits): function train_epoch (line 394) | def train_epoch( function validate (line 588) | def validate(epoch, model, loader, loss_fn, args,_logger, arch_dir,amp_a... FILE: examples/Structure_Evolution/MSE-NAS/utils.py function drop_path (line 19) | def drop_path(x, drop_prob): class AvgrageMeter (line 28) | class AvgrageMeter(object): method __init__ (line 30) | def __init__(self): method reset (line 33) | def reset(self): method update (line 38) | def update(self, val, n=1): function accuracy (line 44) | def accuracy(output, target, topk=(1,)): class Cutout (line 64) | class Cutout(object): method __init__ (line 65) | def __init__(self, length): method __call__ (line 68) | def __call__(self, img): function _data_transforms_cifar (line 86) | def _data_transforms_cifar(args): function count_parameters_in_MB (line 119) | def count_parameters_in_MB(model): function save_checkpoint (line 123) | def save_checkpoint(state, is_best, save): function save (line 131) | def save(model, model_path): function load (line 135) | def load(model, model_path): function drop_path (line 139) | def drop_path(x, drop_prob): function create_exp_dir (line 149) | def create_exp_dir(path, scripts_to_save=None): function calc_time (line 161) | def calc_time(seconds): function save_file (line 168) | def save_file(recoder, path='./', back_connection=False): function data_transforms (line 192) | def data_transforms(args): FILE: examples/TIM/main.py function _parse_args (line 349) | def _parse_args(): function main (line 367) | def main(): function train_epoch (line 738) | def train_epoch( function validate (line 888) | def validate(epoch, model, loader, loss_fn, args, amp_autocast=suppress, FILE: examples/TIM/models/TIM.py class TIM (line 11) | class TIM(BaseModule): method __init__ (line 12) | def __init__(self,dim=256,encode_type='direct',in_channels=16,TIM_alph... method forward (line 25) | def forward(self, x): FILE: examples/TIM/models/spikformer_braincog_DVS.py class MLP (line 17) | class MLP(BaseModule): method __init__ (line 18) | def __init__(self,in_features,step=10,encode_type='direct',hidden_feat... method forward (line 33) | def forward(self, x): class SSA (line 48) | class SSA(BaseModule): method __init__ (line 49) | def __init__(self,dim,step=10,encode_type='direct',num_heads=16,TIM_al... method forward (line 84) | def forward(self, x): class Block (line 122) | class Block(nn.Module): method __init__ (line 123) | def __init__(self, dim, num_heads, step=10,TIM_alpha=0.5, mlp_ratio=4.... method forward (line 136) | def forward(self, x): class SPS (line 141) | class SPS(BaseModule): method __init__ (line 142) | def __init__(self, step=10, encode_type='direct', img_size_h=64, img_s... method forward (line 180) | def forward(self, x): class Spikformer (line 220) | class Spikformer(nn.Module): method __init__ (line 221) | def __init__(self, step=10,TIM_alpha=0.5,if_UCF=False, method _get_pos_embed (line 259) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 267) | def _init_weights(self, m): method forward_features (line 276) | def forward_features(self, x): method forward (line 287) | def forward(self, x): function spikformer_dvs (line 296) | def spikformer_dvs(pretrained=False, **kwargs): FILE: examples/TIM/models/spikformer_braincog_SHD.py class MLP (line 17) | class MLP(BaseModule): method __init__ (line 18) | def __init__(self,in_features,step=10,encode_type='direct',hidden_feat... method forward (line 33) | def forward(self, x): class SSA (line 48) | class SSA(BaseModule): method __init__ (line 49) | def __init__(self,dim,step=10,encode_type='direct',num_heads=16,TIM_al... method forward (line 84) | def forward(self, x): class Block (line 122) | class Block(nn.Module): method __init__ (line 123) | def __init__(self, dim, num_heads, step=10,TIM_alpha=0.5, mlp_ratio=4.... method forward (line 136) | def forward(self, x): class SPS (line 141) | class SPS(BaseModule): method __init__ (line 142) | def __init__(self, step=10, encode_type='direct', img_size_h=64, img_s... method forward (line 180) | def forward(self, x): class Spikformer (line 222) | class Spikformer(nn.Module): method __init__ (line 223) | def __init__(self, step=10,TIM_alpha=0.5,if_UCF=False, method _get_pos_embed (line 261) | def _get_pos_embed(self, pos_embed, patch_embed, H, W): method _init_weights (line 269) | def _init_weights(self, m): method forward_features (line 278) | def forward_features(self, x): method forward (line 289) | def forward(self, x): function spikformer_shd (line 298) | def spikformer_shd(pretrained=False, **kwargs): FILE: examples/TIM/utils/MyGrad.py class MyGrad (line 6) | class MyGrad(SurrogateFunctionBase): method __init__ (line 7) | def __init__(self, alpha=4., requires_grad=False): method act_fun (line 11) | def act_fun(x, alpha): FILE: examples/TIM/utils/MyNode.py class MyBaseNode (line 7) | class MyBaseNode(BaseNode): method __init__ (line 8) | def __init__(self,threshold=0.5,step=10,layer_by_layer=False,mem_detac... method rearrange2node (line 10) | def rearrange2node(self, inputs): method rearrange2op (line 37) | def rearrange2op(self, inputs): class MyNode (line 62) | class MyNode(MyBaseNode): method __init__ (line 63) | def __init__(self, threshold=1.,step=10,layer_by_layer=True,tau=2., ac... method integral (line 69) | def integral(self, inputs): method calc_spike (line 71) | def calc_spike(self): FILE: examples/TIM/utils/datasets.py function unpack_mix_param (line 52) | def unpack_mix_param(args): function build_transform (line 65) | def build_transform(is_train, img_size): function build_dataset (line 109) | def build_dataset(is_train, img_size, dataset, path, same_da=False): class MNISTData (line 135) | class MNISTData(object): method __init__ (line 140) | def __init__(self, method get_data_loaders (line 157) | def get_data_loaders(self): method get_standard_data (line 171) | def get_standard_data(self): function get_mnist_data (line 182) | def get_mnist_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_fashion_data (line 228) | def get_fashion_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_cifar10_data (line 261) | def get_cifar10_data(batch_size, num_workers=8, same_da=False, **kwargs): function get_shd_data (line 304) | def get_shd_data(batch_size, step, **kwargs): function get_cifar100_data (line 346) | def get_cifar100_data(batch_size, num_workers=8, same_data=False, *args,... function get_imnet_data (line 389) | def get_imnet_data(args, _logger, data_config, num_aug_splits, **kwargs): function get_dvsg_data (line 481) | def get_dvsg_data(batch_size, step, **kwargs): function get_dvsc10_data (line 582) | def get_dvsc10_data(batch_size, step, **kwargs): function get_nmnist_data (line 704) | def get_nmnist_data(batch_size, step, **kwargs): function get_NCALTECH101_data (line 826) | def get_NCALTECH101_data(batch_size, step, **kwargs): function get_UCF101DVS_data (line 955) | def get_UCF101DVS_data(batch_size, step, **kwargs): function get_HMDBDVS_data (line 1061) | def get_HMDBDVS_data(batch_size, step, **kwargs): function get_nomni_data (line 1288) | def get_nomni_data(batch_size, train_portion=1., **kwargs): FILE: examples/decision_making/BDM-SNN/BDM-SNN-UAV.py function chooseAct (line 22) | def chooseAct(Net,input,weight_trace_d1,weight_trace_d2): function updateNet (line 41) | def updateNet(Net,reward, action, state,weight_trace_d1,weight_trace_d2): FILE: examples/decision_making/BDM-SNN/BDM-SNN-hh.py function load_images (line 18) | def load_images(): class Bird (line 38) | class Bird(pygame.sprite.Sprite): method __init__ (line 51) | def __init__(self, x, y, msec_to_climb, images): method update (line 59) | def update(self, action,state,delta_frames=1): method sink (line 78) | def sink(self, delta_frames=1): method image (line 82) | def image(self): method mask (line 89) | def mask(self): method rect (line 96) | def rect(self): class PipePair (line 99) | class PipePair(pygame.sprite.Sprite): method __init__ (line 109) | def __init__(self, pipe_end_img, pipe_body_img): method top_height_px (line 152) | def top_height_px(self): method bottom_height_px (line 156) | def bottom_height_px(self): method visible (line 160) | def visible(self): method rect (line 164) | def rect(self): method update (line 167) | def update(self, delta_frames=1): method collides_with (line 170) | def collides_with(self, bird): function chooseAct (line 173) | def chooseAct(Net,input,weight_trace_d1,weight_trace_d2): function judgeState (line 192) | def judgeState(bird, pipes, collide): function blankState (line 242) | def blankState(bird, center): function getReward (line 268) | def getReward(state,lastState,smallerError,isNewPipe): function updateNet (line 307) | def updateNet(Net,reward, action, state,weight_trace_d1,weight_trace_d2): FILE: examples/decision_making/BDM-SNN/BDM-SNN.py function load_images (line 17) | def load_images(): class Bird (line 39) | class Bird(pygame.sprite.Sprite): method __init__ (line 52) | def __init__(self, x, y, msec_to_climb, images): method update (line 60) | def update(self, action, state, delta_frames=1): method sink (line 79) | def sink(self, delta_frames=1): method image (line 83) | def image(self): method mask (line 90) | def mask(self): method rect (line 97) | def rect(self): class PipePair (line 101) | class PipePair(pygame.sprite.Sprite): method __init__ (line 111) | def __init__(self, pipe_end_img, pipe_body_img): method top_height_px (line 154) | def top_height_px(self): method bottom_height_px (line 158) | def bottom_height_px(self): method visible (line 162) | def visible(self): method rect (line 166) | def rect(self): method update (line 169) | def update(self, delta_frames=1): method collides_with (line 172) | def collides_with(self, bird): function chooseAct (line 176) | def chooseAct(Net, input, weight_trace_d1, weight_trace_d2): function judgeState (line 196) | def judgeState(bird, pipes, collide): function blankState (line 247) | def blankState(bird, center): function getReward (line 274) | def getReward(state, lastState, smallerError, isNewPipe): function updateNet (line 314) | def updateNet(Net, reward, action, state, weight_trace_d1, weight_trace_... FILE: examples/decision_making/BDM-SNN/decisionmaking.py class BDMSNN (line 24) | class BDMSNN(nn.Module): method __init__ (line 25) | def __init__(self, num_state, num_action, weight_exc, weight_inh, node... method forward (line 86) | def forward(self, input): method UpdateWeight (line 107) | def UpdateWeight(self, i, s, num_action, dw): method reset (line 131) | def reset(self): method getweight (line 141) | def getweight(self): function load_images (line 148) | def load_images(): class Bird (line 188) | class Bird(pygame.sprite.Sprite): method __init__ (line 198) | def __init__(self, x, y, msec_to_climb, images): method update (line 206) | def update(self, action,state,delta_frames=1): method sink (line 219) | def sink(self, delta_frames=1): method image (line 223) | def image(self): method mask (line 230) | def mask(self): method rect (line 237) | def rect(self): class PipePair (line 240) | class PipePair(pygame.sprite.Sprite): method __init__ (line 247) | def __init__(self, pipe_end_img, pipe_body_img): method top_height_px (line 300) | def top_height_px(self): method bottom_height_px (line 305) | def bottom_height_px(self): method visible (line 310) | def visible(self): method rect (line 315) | def rect(self): method update (line 319) | def update(self, delta_frames=1): method collides_with (line 328) | def collides_with(self, bird): function chooseAct (line 337) | def chooseAct(Net,s,input,weight_trace_d1,weight_trace_d2): function judgeState (line 352) | def judgeState(bird, pipes, collide): function blankState (line 395) | def blankState(bird, center): # judge the state before passing the pipe function getReward (line 415) | def getReward(state,lastState,smallerError,isNewPipe): function updateNet (line 446) | def updateNet(Net,reward, action, state,weight_trace_d1,weight_trace_d2): FILE: examples/decision_making/RL/atari/atari_wrapper.py class NoopResetEnv (line 11) | class NoopResetEnv(gym.Wrapper): method __init__ (line 19) | def __init__(self, env, noop_max=30): method reset (line 25) | def reset(self): class MaxAndSkipEnv (line 35) | class MaxAndSkipEnv(gym.Wrapper): method __init__ (line 43) | def __init__(self, env, skip=4): method step (line 47) | def step(self, action): class EpisodicLifeEnv (line 62) | class EpisodicLifeEnv(gym.Wrapper): method __init__ (line 69) | def __init__(self, env): method step (line 74) | def step(self, action): method reset (line 88) | def reset(self): class FireResetEnv (line 102) | class FireResetEnv(gym.Wrapper): method __init__ (line 109) | def __init__(self, env): method reset (line 114) | def reset(self): class WarpFrame (line 119) | class WarpFrame(gym.ObservationWrapper): method __init__ (line 125) | def __init__(self, env): method observation (line 135) | def observation(self, frame): class ScaledFloatFrame (line 141) | class ScaledFloatFrame(gym.ObservationWrapper): method __init__ (line 147) | def __init__(self, env): method observation (line 157) | def observation(self, observation): class ClipRewardEnv (line 161) | class ClipRewardEnv(gym.RewardWrapper): method __init__ (line 167) | def __init__(self, env): method reward (line 171) | def reward(self, reward): class FrameStack (line 176) | class FrameStack(gym.Wrapper): method __init__ (line 183) | def __init__(self, env, n_frames): method reset (line 195) | def reset(self): method step (line 201) | def step(self, action): method _get_ob (line 206) | def _get_ob(self): function wrap_deepmind (line 212) | def wrap_deepmind( FILE: examples/decision_making/RL/mcs-fqf/discrete.py class SpikePopEncodingNetwork (line 13) | class SpikePopEncodingNetwork(nn.Module): method __init__ (line 26) | def __init__(self, num_cosines: int, embedding_dim: int, device, time_... method reset (line 46) | def reset(self): method forward (line 51) | def forward(self, taus: torch.Tensor, time_window: int) -> torch.Tensor: class SpikeFractionProposalNetwork (line 68) | class SpikeFractionProposalNetwork(nn.Module): method __init__ (line 80) | def __init__(self, num_fractions: int, embedding_dim: int) -> None: method forward (line 88) | def forward( class MCQuantiles (line 105) | class MCQuantiles(nn.Module): method __init__ (line 106) | def __init__(self, method reset (line 126) | def reset(self): method forward (line 131) | def forward(self, state_embedding, tau_embedding): class SpikeFullQuantileFunction (line 165) | class SpikeFullQuantileFunction(nn.Module): method __init__ (line 185) | def __init__( method forward (line 205) | def forward( # type: ignore FILE: examples/decision_making/RL/mcs-fqf/main.py function get_args (line 17) | def get_args(): function make_atari_env (line 67) | def make_atari_env(args): function make_atari_env_watch (line 71) | def make_atari_env_watch(args): function main (line 80) | def main(args=get_args()): FILE: examples/decision_making/RL/mcs-fqf/network.py class SpikingDQN (line 11) | class SpikingDQN(nn.Module): method __init__ (line 18) | def __init__( method reset (line 80) | def reset(self): method forward (line 85) | def forward( FILE: examples/decision_making/RL/mcs-fqf/policy.py class FQFPolicy (line 12) | class FQFPolicy(QRDQNPolicy): method __init__ (line 37) | def __init__( method _target_q (line 59) | def _target_q(self, buffer: ReplayBuffer, indices: np.ndarray) -> torc... method forward (line 74) | def forward( method learn (line 118) | def learn(self, batch: Batch, **kwargs: Any) -> Dict[str, float]: FILE: examples/decision_making/RL/sdqn/main.py function get_args (line 27) | def get_args(): function make_atari_env (line 77) | def make_atari_env(args): function make_atari_env_watch (line 81) | def make_atari_env_watch(args): function main (line 90) | def main(args=get_args()): FILE: examples/decision_making/RL/sdqn/network.py class SpikingDQN (line 11) | class SpikingDQN(nn.Module): method __init__ (line 18) | def __init__( method reset (line 60) | def reset(self): method forward (line 65) | def forward( FILE: examples/decision_making/RL/utils/normalization.py class PopNorm (line 15) | class PopNorm(Module): method __init__ (line 77) | def __init__(self, normalized_shape: _shape_t, threshold: float, v_res... method reset_parameters (line 95) | def reset_parameters(self) -> None: method forward (line 101) | def forward(self, input: Tensor) -> Tensor: method extra_repr (line 109) | def extra_repr(self) -> Tensor: class _NormBase (line 114) | class _NormBase(nn.Module): method __init__ (line 127) | def __init__( method reset_running_stats (line 167) | def reset_running_stats(self) -> None: method reset_parameters (line 175) | def reset_parameters(self) -> None: method _check_input_dim (line 182) | def _check_input_dim(self, input): method extra_repr (line 185) | def extra_repr(self): method _load_from_state_dict (line 191) | def _load_from_state_dict( class _BatchNorm (line 220) | class _BatchNorm(_NormBase): method __init__ (line 221) | def __init__( method forward (line 237) | def forward(self, input: Tensor) -> Tensor: class PDBatchNorm2d (line 286) | class PDBatchNorm2d(_BatchNorm): method _check_input_dim (line 353) | def _check_input_dim(self, input): FILE: examples/decision_making/swarm/Collision-Avoidance.py function chooseAct (line 75) | def chooseAct(Net,input,explore): function update_boids (line 98) | def update_boids(xs, ys, xvs, yvs,frame): function animate (line 262) | def animate(frame):