I am working on incorporating some custom code for learning using memristors into the Nengo backend, as groundwork for implementation into NengoDL.
My focus is on efficiency, as my current code running in a
Node really does not scale well with the pre and post number of neurons.
The reason for this is that I’m simulating a full matrix of memristors, one for each (pre-post) neuron pair, and updating this at each timestep, as can be seen in the following snippet:
# create memristor array that implement the weights self.memristors = np.empty( (self.output_size, self.input_size), dtype=Memristor ) for i in range( self.output_size ): for j in range( self.input_size ): self.memristors[ i, j ] = self.memristor_model( seed=seed, voltage_converter=self.voltage_converter, base_voltage=self.base_voltage, gain=self.gain ) self.weights[ i, j ] = self.memristors[ i, j ].get_state()
My custom learning rules check for spikes and updates the corresponding memristors:
# we only need to update the weights for the neurons that spiked so we filter for their columns if spiked_map.any(): for j, i in np.transpose( np.where( spiked_map ) ): update = self.memristors[ j, i ].pulse( signal[ j, i ] ) # update = update if update >= self.weights[ j, i ] = update
I think I’m quite clear on the build process but I’m not sure of how much simply moving my code to a custom
LearningRule could improve the running time, as using a
Node and simulating 30 seconds with 100 pre/post neurons takes around one hour.
I was thus wondering if adding a new
Memristor object type to Nengo could help. I would imitate the
Ensemble implementations to have an object representing a vector of memristors whose current resistances are kept track in a
Signal, exactly how it is done for the voltage and refractory time of
Would implementing this new
Memristor object (that inherits from
FrozenObject) in such a way help the efficiency? I was thinking that this way I could take advantage of the scheduler and optimiser in the Simulator.
Unfortunately, I am not sure of how to actually build such a custom object into the Simulator as it isn’t a
Probe. I would have to somehow call
model.build() outside of the
Simulator but I can’t see a way to do that.
Is it only feasible to add custom implementations of