Skip to content
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

Spinncer weight scale #107

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4317a59
Fix for change of interface
rowleya May 1, 2020
e6d939b
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Jul 28, 2020
7174c0f
Update STDP timing and weight to include new scaling functions
andrewgait Jul 31, 2020
92a5e15
Update STDP integration test
andrewgait Jul 31, 2020
cb57025
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Aug 20, 2020
d420c6e
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Oct 6, 2020
8a75838
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Oct 15, 2020
a280738
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Jan 15, 2021
81b2ed5
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Feb 5, 2021
2fe65ca
Merge branch 'master' into weight_scale
andrewgait Feb 26, 2021
97c9a7d
Merge branch 'master' into weight_scale
dkfellows Mar 26, 2021
736521a
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Apr 13, 2021
d45f532
Merge branch 'master' into weight_scale
andrewgait Apr 29, 2021
7e57214
Merge branch 'master' into weight_scale
andrewgait Jun 10, 2021
b0624e9
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Jul 9, 2021
b8e32fe
Add function to get minimum weight
andrewgait Oct 12, 2021
f3d4cdc
Merge branch 'master' into weight_scale
andrewgait Nov 8, 2021
b6e72f3
Missed this when merging...
andrewgait Nov 8, 2021
c51d719
Update weight impl
andrewgait Nov 10, 2021
b2ca3e9
Merge branch 'master' into weight_scale
andrewgait Feb 25, 2022
8ed4207
Merge branch 'master' into weight_scale
andrewgait Mar 28, 2022
753ab22
Merge branch 'master' into weight_scale
andrewgait Apr 21, 2022
982e0a6
Merge branch 'master' into weight_scale
andrewgait May 20, 2022
2a1ec73
Merge branch 'master' into weight_scale
andrewgait Jul 11, 2022
dceb2d8
Merge branch 'master' into weight_scale
andrewgait Jul 22, 2022
d569259
Missed in merge
andrewgait Jul 22, 2022
efc178a
Missed this one too
andrewgait Jul 22, 2022
20554cb
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Aug 4, 2022
7d5827f
Merge branch 'master' into weight_scale
andrewgait Sep 9, 2022
966511d
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Sep 16, 2022
ef0e530
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Nov 18, 2022
caf8014
Match downstream change in sPyNNaker
andrewgait Nov 22, 2022
ebdc2cb
Match change in sPyNNaker
andrewgait Nov 23, 2022
017e9e9
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Nov 24, 2022
f43d4c1
Merge branch 'master' into weight_scale
andrewgait Jan 11, 2023
e6161d2
Merge branch 'master' into weight_scale
andrewgait Jan 11, 2023
f4cf911
Merge branch 'master' into weight_scale
andrewgait Feb 20, 2023
aac9f14
Merge branch 'master' into weight_scale
andrewgait Feb 20, 2023
8f5a4d0
Merge branch 'master' into weight_scale
andrewgait Apr 11, 2023
4cbe339
Merge branch 'master' into weight_scale
andrewgait Apr 21, 2023
f81ad2a
Merge remote-tracking branch 'origin/master' into weight_scale
andrewgait Jun 23, 2023
90b2d5a
Merge remote-tracking branch 'origin/master' into spinncer_weight_scale
andrewgait Aug 3, 2023
87d3d62
Merge remote-tracking branch 'origin/master' into spinncer_weight_scale
andrewgait Aug 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ plasticity_weight_region_data_t *plasticity_weight_region_data;

address_t weight_initialise(
address_t address, uint32_t n_synapse_types,
uint32_t *ring_buffer_to_input_buffer_left_shifts) {

// This can be used to indicate the scaling used on the weights
use(ring_buffer_to_input_buffer_left_shifts);
UNUSED REAL *min_weights) {

log_info("weight_initialise: starting");
log_info("\tSTDP my weight dependence");
Expand Down
2 changes: 1 addition & 1 deletion nmt_integration_tests/test_my_model_curr_exp_stdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def do_run(self):
neo = test_pop.get_data('all')
sim.end()
for _, _, weight in weights:
self.assertEqual(weight, 0.5)
self.assertAlmostEqual(weight, 0.5, places=2)
self.check_results(neo, [201, 402, 603, 804])

def test_do_run(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from spinn_utilities.overrides import overrides
from spinn_front_end_common.interface.ds import DataType
from spinn_front_end_common.utilities.constants import BYTES_PER_WORD
from spinn_front_end_common.utilities.constants import (
BYTES_PER_WORD, MICRO_TO_MILLISECOND_CONVERSION)
from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import (
AbstractTimingDependence)
from spynnaker.pyNN.models.neuron.plasticity.stdp.synapse_structure import (
SynapseStructureWeightOnly)
from spynnaker.pyNN.models.neuron.plasticity.stdp.common import (
get_exp_lut_array, get_min_lut_value)
from spynnaker.pyNN.data import SpynnakerDataView


class MyTimingDependence(AbstractTimingDependence):
Expand All @@ -13,6 +17,8 @@ class MyTimingDependence(AbstractTimingDependence):
"_a_plus",
"_my_depression_parameter",
"_my_potentiation_parameter",
"_my_depression_data",
"_my_potentiation_data",
"_synapse_structure"]

NUM_PARAMETERS = 2
Expand All @@ -38,6 +44,13 @@ def __init__(
self._a_plus = A_plus
self._a_minus = A_minus

ts = SpynnakerDataView.get_simulation_time_step_ms()
ts = ts / MICRO_TO_MILLISECOND_CONVERSION
self._my_potentiation_data = get_exp_lut_array(
ts, self._my_potentiation_parameter)
self._my_depression_data = get_exp_lut_array(
ts, self._my_depression_parameter)

# TODO: Add getters and setters for parameters

@property
Expand Down Expand Up @@ -113,6 +126,15 @@ def write_parameters(
def get_parameter_names(self):
return ['my_potentiation_parameter', 'my_depression_parameter']

@overrides(AbstractTimingDependence.minimum_delta)
def minimum_delta(self, max_stdp_spike_delta):
ts = SpynnakerDataView.get_simulation_time_step_ms()
return [
get_min_lut_value(self._my_potentiation_data, ts,
max_stdp_spike_delta),
get_min_lut_value(self._my_depression_data, ts,
max_stdp_spike_delta)]

@property
def synaptic_structure(self):
""" Get the synaptic structure of the plastic part of the rows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ def weight_maximum(self):
# give to a synapse
return self._w_max

@property
def weight_minimum(self):
""" The minimum weight that will ever be set in a synapse as a result\
of this rule
"""
# TODO: update to return the minimum weight that this rule will ever
# give to a synapse
return self._w_min

@overrides(AbstractWeightDependence.weight_change_minimum)
def weight_change_minimum(self, min_delta):
pot, dep = min_delta
return min(pot * self._my_weight_parameter,
dep * self._my_weight_parameter)

@overrides(AbstractWeightDependence.get_parameter_names)
def get_parameter_names(self):
return ['w_min', 'w_max', 'my_weight_parameter']