Hello everyone,
I am trying to use NengoDL as backend and wanted to collect some data from the simulation (for analysis purposes), I know that in Nengo the probes are stored in memory, which may cause a problem when running long simulations and can’t preserve all the data, that’s why I used an additional Node
to store the Probes somewhere else and preserve only the last entry during the simulation, using the self.sim._sim_data[probe]
when using Nengo core, and it works great!
I tried the same thing when switching to NengoDL, by changing self.sim._sim_data[probe]
to self.sim.data[probe]
but I am getting an empty array, so my guesses are:
- The probes are stored maybe somewhere else (TensorFlow side ?)
- The probes are stored at the end of the simulation and no way to access it while simulating (I hope not )
I hope someone can clarify this for me.
Here is the network creation part:
with model:
# input layer
picture = nengo.Node(PresentInputWithPause(image_train_filtered, presentation_time,pause_time))
input_layer = nengo.Ensemble(
784,
1,
label="input",
neuron_type=nengo.neurons.PoissonSpiking(nengo.LIFRate(amplitude=0.2)),
gain=nengo.dists.Choice([2]),
encoders=nengo.dists.Choice([[1]]),
bias=nengo.dists.Choice([0])
)
input_conn = nengo.Connection(picture,input_layer.neurons)
# weights randomly initiated
layer1_weights = random.random((n_neurons, 784))
# define first layer
layer1 = nengo.Ensemble(
n_neurons,
1,
label="layer1",
neuron_type=nengo.LIF(),
intercepts=nengo.dists.Choice([0]),
max_rates=nengo.dists.Choice([22,22]),
encoders=nengo.dists.Choice([[1]]))
conn1 = nengo.Connection(
input_layer.neurons,
layer1.neurons,
transform=layer1_weights,
learning_rule_type=nengo.BCM()
)
# create inhibitory layer
inhib_wegihts = (np.full((n_neurons, n_neurons), 1) - np.eye(n_neurons)) * (- 2)
inhib = nengo.Connection(
layer1.neurons,
layer1.neurons,
synapse=0.005,
transform=inhib_wegihts
)
#############################
# setup the probes
#############################
connection_layer1_probe = nengo.Probe(conn1,"weights",label="layer1_synapses") # ('output', 'input', 'weights')
# log = instance of the class where Probe is stored and only last entry is preserved
nengo.Node(log)
with nengo_dl.Simulator(model,dt=0.005) as sim:
log.set(sim)
sim.run((presentation_time + pause_time) * label_train_filtered.shape[0])
Thank you