-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stochastic neurons #1424
Stochastic neurons #1424
Conversation
…hester/sPyNNaker.git into stochastic_neurons
I think this is ready now - the models work as they are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to address before looking at the actual changes
@@ -0,0 +1,24 @@ | |||
# Copyright (c) 2017 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- New but dated 2017?
- Not built
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,24 @@ | |||
# Copyright (c) 2014 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- new but dated 2014
- Not built
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
threshold_type = ThresholdTypeFixedProb(v_thresh, p_thresh, seed) | ||
super().__init__( | ||
model_name="IF_curr_delta_fixed_prob", | ||
binary="IF_curr_delta_fixed_prob.aplx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never built!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and test added
@@ -0,0 +1,73 @@ | |||
# Copyright (c) 2017 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1, new but dated 2017
2. Never tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and test added
threshold_type = ThresholdTypeStatic(v_thresh) | ||
|
||
super().__init__( | ||
model_name="IF_trunc_delta", binary="IF_trunc_delta.aplx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not exists!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added build and test added
@@ -0,0 +1,27 @@ | |||
# Copyright (c) 2015 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,31 @@ | |||
# Copyright (c) 2015 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,88 @@ | |||
# Copyright (c) 2015 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,73 @@ | |||
# Copyright (c) 2017 The University of Manchester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more comments.
Especially double recording yet only sdram space for 1
possible double spike
return ukbits(accumulator); | ||
} | ||
|
||
static const uint64_t MAX_REAL = 0xFFFFFFFF0000L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
|
||
static const uint64_t MAX_REAL = 0xFFFFFFFF0000L; | ||
|
||
static const uint64_t MIN_REAL = 0x000000010000L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
SOMETIMES_UNUSED // Marked unused as only used sometimes | ||
static bool neuron_impl_initialise(uint32_t n_neurons) { | ||
// Allocate DTCM for neuron array | ||
if (sizeof(neuron_impl_t) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this check?
neuron_impl_t is defined locally so will never have size 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
//! Array of neuron states | ||
static neuron_impl_t *neuron_array; | ||
|
||
SOMETIMES_UNUSED // Marked unused as only used sometimes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unusual having all these SOMETIMES_UNUSED in an h file only included in one make file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from this file in general
|
||
// Record things | ||
neuron_recording_record_int32(PROB_INDEX, neuron_index, 0); | ||
neuron_recording_record_accum(V_RECORDING_INDEX, neuron_index, ZERO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to record these with the same index and time before and after spike?
Or better to use a different index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't record twice - there was a continue but now updated to use else, and separated code into separate functions
uint32_t random = mars_kiss64_seed(neuron->random_seed); | ||
|
||
// If the random number is less than the probability value, spike | ||
if (random < prob) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a neuron could spike twice in one timestep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
} | ||
|
||
SOMETIMES_UNUSED // Marked unused as only used sometimes | ||
static void neuron_impl_do_timestep_update( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments about index used twice, sdram and possible double spike
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
} | ||
|
||
SOMETIMES_UNUSED // Marked unused as only used sometimes | ||
static void neuron_impl_do_timestep_update( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again indexes reused only sdram for 1 recording and two chances to spike
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
REAL v_membrane = (neuron->bias + neuron->inputs[0]) - neuron->inputs[1]; | ||
|
||
// Record things | ||
neuron_recording_record_accum(V_RECORDING_INDEX, neuron_index, v_membrane); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some timesteps will record twice.
yet neuron recorder sampling rates are 1
this will cause you to run out of sdram on a long run!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok pending Jenkins being green
Jenkins is green so merging! |
Adds a couple of stochastic neuron models that might make WTA and Travelling Salesman problems work better