Skip to content

feat: add rate spikegen for snns

Jerome Hue requested to merge jeromeh/aidge_core:spikegen into dev

Context

There are different methods to convert an input image to a spike train of sequence length num_steps for SNNs.

This MR aims to implement a basic version of rate coding : each input value is used as a probability of spiking.

For instance :

auto spikes = spikegenRate({0,0,0}, 3); 
// spikes = {{0,0,0}, {0,0,0}, {0,0,0}}

auto spikes = spikegenRate({1,1,1, 1}, 1); 
// spikes = {1,1,1,1}

Modifications

  • Added a helper Tensor.repeat(n) method to repeat a tensor n times.
  • Added a spikegenRate(std::shared_ptr<Tensor> tensor, std::uint32_t numSteps) -> Tensor method. spikegenRate replicates the input tensor for a specified number of steps and then converts its values into binary spikes using a rate-based (probabilistic) approach.
Edited by Jerome Hue

Merge request reports

Loading