- class sinabs.layers.Img2SpikeLayer(image_shape, tw: int = 100, max_rate: float = 1000, norm: float = 255.0, squeeze: bool = False, negative_spikes: bool = False)#
Layer to convert images to spikes.
image_shape – tuple image shape
tw (int) – int Time window length
max_rate (float) – maximum firing rate of neurons
layer_name – string layer name
norm (float) – the supposed maximum value of the input (default 255.0)
squeeze (bool) – whether to remove singleton dimensions from the input
negative_spikes (bool) – whether to allow negative spikes in response to negative input
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.