Skip to content
Snippets Groups Projects

feat: add rate spikegen for snns

Merged 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

Code Quality is loading
Test summary results are being parsed

Merged by Jerome HueJerome Hue 3 weeks ago (Mar 3, 2025 1:32pm UTC)

Loading

Pipeline #67061 passed

Pipeline passed for fd3f8a3b on dev

Test coverage 51.45% (0.15%) from 2 jobs

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Maxence Naud
  • Jerome Hue added 1 commit

    added 1 commit

    • bba4dd14 - Make a local function static

    Compare with previous version

  • Jerome Hue added 1 commit

    added 1 commit

    • b775a82c - Make a local function static

    Compare with previous version

  • Jerome Hue changed the description

    changed the description

  • Maxence Naud approved this merge request

    approved this merge request

  • Maxence Naud mentioned in issue #245

    mentioned in issue #245

  • Maxence Naud added 9 commits

    added 9 commits

    • b775a82c...76ccc349 - 2 commits from branch eclipse/aidge:dev
    • 764504df - Add a Tensor.repeat() method
    • 70a0be1f - Add unit test for Tensor.repeat()
    • cada2936 - First draft of spikegen rate convert function
    • d12e93cd - Minor changes (doc, functions signatures)
    • b76754c4 - Add basic test for Spikegen functions
    • 7bb39405 - Add python binding for spikegen rate function
    • fd3f8a3b - Make a local function static

    Compare with previous version

  • Maxence Naud resolved all threads

    resolved all threads

  • Jerome Hue enabled an automatic merge when all merge checks for fd3f8a3b pass

    enabled an automatic merge when all merge checks for fd3f8a3b pass

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading