Is this the right way to define my own SNN?

I am using the following model:

n_in = 2
n_hidden = 5
n_out = 3
minibatch_size = 1

connection_weights1 = np.array([[ 0.1, 0.1 ],
[0.1, 0.5],
[ 0.5 , 0.1],
[0.1, 0.2],
[ 0.6, 0.4 ]])

connection_weights2 = np.array([[ 0.1 , 0.2, 0.3, 0.8, 0.1],
[0.2, 0.7, 0.4, 0.1, 0.1],
[0.9, 0.1, 0.3 , 0.5 , 0.1]])

sp_model = nengo.Network()
with sp_model:
# input
#sp_model.config[nengo.Ensemble].gain = nengo.dists.Choice([1])
#sp_model.config[nengo.Ensemble].bias = nengo.dists.Choice([0])
#sp_model.config[nengo.Ensemble].intercepts = nengo.dists.Choice([0])
#sp_model.config[nengo.Connection].synapse = None
#sp_model.config[nengo.Ensemble].max_rates = nengo.dists.Choice([1])

nengo_a = nengo.Node(np.ones(n_in))

nengo_b = nengo.Ensemble(n_hidden, 1, neuron_type=nengo.LIF()).neurons
nengo_c = nengo.Ensemble(n_out, 1, neuron_type=nengo.LIF()).neurons

con1 = nengo.Connection(nengo_a, nengo_b, transform=connection_weights1)
con2 = nengo.Connection(nengo_b, nengo_c, transform=connection_weights2)
    

# probes are used to collect data from the network
p_b = nengo.Probe(nengo_b)
p_c = nengo.Probe(nengo_c)

Now, the output spikes look weird. Can someone tell me why?

data_inp =np.ones((minibatch_size, 10, n_in))
with nengo_dl.Simulator(sp_model) as sim:
out=sim.predict(n_steps=10,x={nengo_a : data_inp})

{<Probe at 0x204f1464310 of ‘output’ of <Neurons of <Ensemble (unlabeled) at 0x204f9db6560>>>: array([[[ 0. , 0. , 0. , 999.99994, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[999.99994, 0. , 0. , 999.99994, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 999.99994, 0. , 0. ],
[ 0. , 0. , 0. , 999.99994, 999.99994],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
dtype=float32),
<Probe at 0x204f713c7f0 of ‘output’ of <Neurons of <Ensemble (unlabeled) at 0x204f9db6680>>>: array([[[999.99994, 0. , 0. ],
[ 0. , 999.99994, 999.99994],
[999.99994, 0. , 0. ],
[ 0. , 999.99994, 999.99994],
[999.99994, 0. , 0. ],
[ 0. , 999.99994, 999.99994],
[999.99994, 0. , 0. ],
[ 0. , 999.99994, 999.99994],
[999.99994, 0. , 0. ],
[ 0. , 999.99994, 999.99994]]], dtype=float32)}

1 Like