33from bindsnet .network import Network
44from bindsnet .network .nodes import LIFNodes
55from bindsnet .network .topology import MulticompartmentConnection
6- from bindsnet .network .topology_features import Weight , Bias , Mask
6+ from bindsnet .network .topology_features import Weight , Bias
77from bindsnet .learning .MCC_learning import PostPre
88
99network = Network (dt = 1.0 )
2222)
2323bias = Bias (name = 'bias_feature' , value = torch .rand (5 , 5 ))
2424
25- mask = torch .tril (torch .ones ((5 , 5 )), diagonal = - 1 ).bool ()
26-
2725connection = MulticompartmentConnection (
2826 source = source_layer ,
2927 target = target_layer ,
30- pipeline = [weight , Mask ( name = 'mask' , value = mask ), bias ],
28+ pipeline = [weight , bias ],
3129 device = 'cpu'
3230)
3331network .add_connection (connection , source = "input" , target = "output" )
3432print (connection .pipeline [0 ].value )
3533network .run (
36- inputs = {"input" : torch .bernoulli (torch .rand (250 , 5 )).byte ()}, time = 250
34+ inputs = {"input" : torch .bernoulli (torch .rand (250 , 5 )).byte ()},
35+ time = 250 ,
36+ masks = {
37+ ('input' , 'output' ): ~ torch .tril (torch .ones ((5 , 5 )), diagonal = - 1 ).bool ()
38+ }
3739)
40+
41+ print (network .layers ['input' ].v )
42+ print (network .layers ['output' ].v )
3843print (connection .pipeline [0 ].value )
0 commit comments