spynnaker.pyNN.models.neuron.synapse_dynamics package¶
Submodules¶
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine.
AbstractGenerateOnMachine
[source]¶ Bases:
object
A synapse dynamics that can be generated on the machine
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
gen_matrix_params
¶ Any parameters required by the matrix generator
Return type: numpy array of uint32
-
gen_matrix_params_size_in_bytes
¶ The size of the parameters of the matrix generator in bytes
Return type: int
-
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_plastic_synapse_dynamics module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_plastic_synapse_dynamics.
AbstractPlasticSynapseDynamics
[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics.AbstractSynapseDynamics
Synapses which change over time
-
get_n_fixed_plastic_words_per_row
(fp_size)[source]¶ Get the number of fixed plastic words to be read from each row
-
get_n_plastic_plastic_words_per_row
(pp_size)[source]¶ Get the number of plastic plastic words to be read from each row
-
get_n_synapses_in_rows
(pp_size, fp_size)[source]¶ Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.
-
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_static_synapse_dynamics module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_static_synapse_dynamics.
AbstractStaticSynapseDynamics
[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics.AbstractSynapseDynamics
Dynamics which don’t change over time.
-
get_n_static_words_per_row
(ff_size)[source]¶ Get the number of bytes to be read per row for the static data given the size that was written to each row
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
-
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics.
AbstractSynapseDynamics
[source]¶ Bases:
object
-
NUMPY_CONNECTORS_DTYPE
= [('source', 'uint32'), ('target', 'uint32'), ('weight', 'float64'), ('delay', 'float64')]¶
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
convert_per_connection_data_to_rows
(connection_row_indices, n_rows, data)[source]¶ Converts per-connection data generated from connections into row-based data to be returned from get_synaptic_data
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_items
(rows, item_size)[source]¶ Get the number of items in each row as 4-byte values, given the item size
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics_structural module¶
spynnaker.pyNN.models.neuron.synapse_dynamics.pynn_synapse_dynamics module¶
spynnaker.pyNN.models.neuron.synapse_dynamics.structural_dynamics module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.structural_dynamics.
StructuralDynamics
(slow=None, fast=None, structure=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.pynn_synapse_dynamics.PyNNSynapseDynamics
-
structure
¶
-
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_static module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_static.
SynapseDynamicsStatic
(pad_to_length=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_static_synapse_dynamics.AbstractStaticSynapseDynamics
,spynnaker.pyNN.models.abstract_models.abstract_settable.AbstractSettable
,spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun
,spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine.AbstractGenerateOnMachine
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_static_words_per_row
(ff_size)[source]¶ Get the number of bytes to be read per row for the static data given the size that was written to each row
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
-
mark_no_changes
()[source]¶ Marks the point after which changes are reported, so that new changes can be detected before the next check. Marks the point after which changes are reported. Immediately after calling this method, requires_mapping should return False.
-
read_static_synaptic_data
(post_vertex_slice, n_synapse_types, ff_size, ff_data)[source]¶ Read the connections from the words of data in ff_data
-
requires_mapping
()[source]¶ True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.
Return type: bool True if changes that have been made require that mapping be performed. Note that this should return True the first time it is called, as the vertex must require mapping as it has been created!
-
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_stdp module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_stdp.
SynapseDynamicsSTDP
(timing_dependence=None, weight_dependence=None, voltage_dependence=None, dendritic_delay_fraction=1.0, pad_to_length=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_plastic_synapse_dynamics.AbstractPlasticSynapseDynamics
,spynnaker.pyNN.models.abstract_models.abstract_settable.AbstractSettable
,spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun
,spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine.AbstractGenerateOnMachine
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
dendritic_delay_fraction
¶
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
gen_matrix_params
¶ Any parameters required by the matrix generator
Return type: numpy array of uint32
-
gen_matrix_params_size_in_bytes
¶ The size of the parameters of the matrix generator in bytes
Return type: int
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_fixed_plastic_words_per_row
(fp_size)[source]¶ Get the number of fixed plastic words to be read from each row
-
get_n_plastic_plastic_words_per_row
(pp_size)[source]¶ Get the number of plastic plastic words to be read from each row
-
get_n_synapses_in_rows
(pp_size, fp_size)[source]¶ Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.
-
get_provenance_data
(pre_population_label, post_population_label)[source]¶ Get the provenance data from this synapse dynamics object
-
mark_no_changes
()[source]¶ Marks the point after which changes are reported, so that new changes can be detected before the next check. Marks the point after which changes are reported. Immediately after calling this method, requires_mapping should return False.
-
read_plastic_synaptic_data
(post_vertex_slice, n_synapse_types, pp_size, pp_data, fp_size, fp_data)[source]¶ Read the connections indicated in the connection indices from the data in pp_data and fp_data
-
requires_mapping
()[source]¶ True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.
Return type: bool True if changes that have been made require that mapping be performed. Note that this should return True the first time it is called, as the vertex must require mapping as it has been created!
-
set_value
(key, value)[source]¶ Set a property
Parameters: - key – the name of the parameter to change
- value – the new value of the parameter to assign Set a property
- key – the name of the parameter to change
- value – the new value of the parameter to assign
-
timing_dependence
¶
-
weight_dependence
¶
-
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_common module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_common.
SynapseDynamicsStructuralCommon
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ -
Common class that enables synaptic rewiring. It acts as a wrapper around SynapseDynamicsStatic or SynapseDynamicsSTDP. This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
actual_sdram_usage
¶ Actual SDRAM usage (based on what is written to spec).
Returns: actual SDRAM usage Return type: int
-
default_parameters
= {'delay': 1, 'f_rew': 10000, 'grid': array([16, 16]), 'lateral_inhibition': 0, 'p_elim_dep': 0.0245, 'p_elim_pot': 0.00013600000000000003, 'p_form_forward': 0.16, 'p_form_lateral': 1.0, 'random_partner': False, 's_max': 32, 'sigma_form_forward': 2.5, 'sigma_form_lateral': 1, 'stdp_model': None, 'weight': 0}¶
-
distance
(x0, x1, grid=array([16, 16]), type='euclidian')[source]¶ Compute the distance between points x0 and x1 place on the grid using periodic boundary conditions.
Parameters: - x0 (np.ndarray of ints) – first point in space
- x1 (np.ndarray of ints) – second point in space
- grid (np.ndarray of ints) – shape of grid
- type (str) – distance metric, i.e. euclidian or manhattan
Returns: the distance
Return type: float
-
generate_distance_probability_array
(probability, sigma)[source]¶ Generate the exponentially decaying probability LUTs.
Parameters: - probability (float) – peak probability
- sigma (float) – spread
Returns: distance-dependent probabilities
Return type: numpy.ndarray(float)
-
get_extra_sdram_usage_in_bytes
(machine_in_edges)[source]¶ Better approximation of SDRAM usage based on incoming machine edges
Parameters: machine_in_edges (machine edges) – incoming machine edges Returns: SDRAM usage Return type: int
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Approximate SDRAM usage
Parameters: - n_neurons (int) – number of neurons
- n_synapse_types (int) – number of synapse types (i.e. excitatory and inhibitory)
- in_edges (edges) – incoming edges
Returns: SDRAM usage
Return type: int
-
p_rew
¶ The period of rewiring.
Returns: The period of rewiring Return type: int
-
synaptic_data_update
(connections, post_vertex_slice, app_edge, machine_edge)[source]¶ Get static synaptic data
-
weight_dynamics
¶
-
write_parameters
(spec, region, machine_time_step, weight_scales, application_graph, machine_graph, app_vertex, post_slice, machine_vertex, graph_mapper, routing_info)[source]¶ Write the synapse parameters to the spec.
Parameters: - spec (spec) – the data spec
- region (int) – memory region
- machine_time_step (int) – the duration of a machine time step (ms)
- weight_scales (list(float)) – scaling the weights
- application_graph (
ApplicationGraph
) – the entire, highest level, graph of the network to be simulated - machine_graph (
MachineGraph
) – the entire, lowest level, graph of the network to be simulated - app_vertex (
ApplicationVertex
) – the highest level object of the post-synaptic population - post_slice (
Slice
) – the slice of the app vertex corresponding to this machine vertex - machine_vertex (
MachineVertex
) – the lowest level object of the post-synaptic population - graph_mapper (
GraphMapper
) – for looking up application vertices - routing_info (
RoutingInfo
) – All of the routing information on the network
Returns: None
Return type: None
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_static module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_static.
SynapseDynamicsStructuralStatic
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics_structural.AbstractSynapseDynamicsStructural
,spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_static.SynapseDynamicsStatic
- Class that enables synaptic rewiring. It acts as a wrapper around SynapseDynamicsStatic.
This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.
Example usage to allow rewiring in parallel with STDP:
stdp_model = sim.STDPMechanism(...) structure_model_with_stdp = sim.StructuralMechanismStatic( weight=0, s_max=32, grid=[np.sqrt(pop_size), np.sqrt(pop_size)], random_partner=True, f_rew=10 ** 4, # Hz sigma_form_forward=1., delay=10 ) plastic_projection = sim.Projection( ..., synapse_dynamics=sim.SynapseDynamics( slow=structure_model_with_stdp ) )
Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, app_edge, machine_edge)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_stdp module¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_structural_stdp.
SynapseDynamicsStructuralSTDP
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics_structural.AbstractSynapseDynamicsStructural
,spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_stdp.SynapseDynamicsSTDP
- Class that enables synaptic rewiring. It acts as a wrapper
around SynapseDynamicsSTDP. This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.
Example usage to allow rewiring in parallel with STDP:
stdp_model = sim.STDPMechanism(...) structure_model_with_stdp = sim.StructuralMechanismSTDP( stdp_model=stdp_model, weight=0, s_max=32, grid=[np.sqrt(pop_size), np.sqrt(pop_size)], random_partner=True, f_rew=10 ** 4, # Hz sigma_form_forward=1., delay=10 ) plastic_projection = sim.Projection( ..., synapse_dynamics=sim.SynapseDynamics( slow=structure_model_with_stdp ) )
Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, app_edge, machine_edge)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.
Module contents¶
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
AbstractSynapseDynamics
[source]¶ Bases:
object
-
NUMPY_CONNECTORS_DTYPE
= [('source', 'uint32'), ('target', 'uint32'), ('weight', 'float64'), ('delay', 'float64')]¶
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
convert_per_connection_data_to_rows
(connection_row_indices, n_rows, data)[source]¶ Converts per-connection data generated from connections into row-based data to be returned from get_synaptic_data
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_items
(rows, item_size)[source]¶ Get the number of items in each row as 4-byte values, given the item size
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
AbstractGenerateOnMachine
[source]¶ Bases:
object
A synapse dynamics that can be generated on the machine
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
gen_matrix_params
¶ Any parameters required by the matrix generator
Return type: numpy array of uint32
-
gen_matrix_params_size_in_bytes
¶ The size of the parameters of the matrix generator in bytes
Return type: int
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
AbstractStaticSynapseDynamics
[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics.AbstractSynapseDynamics
Dynamics which don’t change over time.
-
get_n_static_words_per_row
(ff_size)[source]¶ Get the number of bytes to be read per row for the static data given the size that was written to each row
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
AbstractPlasticSynapseDynamics
[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics.AbstractSynapseDynamics
Synapses which change over time
-
get_n_fixed_plastic_words_per_row
(fp_size)[source]¶ Get the number of fixed plastic words to be read from each row
-
get_n_plastic_plastic_words_per_row
(pp_size)[source]¶ Get the number of plastic plastic words to be read from each row
-
get_n_synapses_in_rows
(pp_size, fp_size)[source]¶ Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
PyNNSynapseDynamics
(slow=None, fast=None)[source]¶ Bases:
object
-
slow
¶
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
SynapseDynamicsStatic
(pad_to_length=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_static_synapse_dynamics.AbstractStaticSynapseDynamics
,spynnaker.pyNN.models.abstract_models.abstract_settable.AbstractSettable
,spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun
,spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine.AbstractGenerateOnMachine
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_static_words_per_row
(ff_size)[source]¶ Get the number of bytes to be read per row for the static data given the size that was written to each row
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
-
mark_no_changes
()[source]¶ Marks the point after which changes are reported, so that new changes can be detected before the next check. Marks the point after which changes are reported. Immediately after calling this method, requires_mapping should return False.
-
read_static_synaptic_data
(post_vertex_slice, n_synapse_types, ff_size, ff_data)[source]¶ Read the connections from the words of data in ff_data
-
requires_mapping
()[source]¶ True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.
Return type: bool True if changes that have been made require that mapping be performed. Note that this should return True the first time it is called, as the vertex must require mapping as it has been created!
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
SynapseDynamicsSTDP
(timing_dependence=None, weight_dependence=None, voltage_dependence=None, dendritic_delay_fraction=1.0, pad_to_length=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_plastic_synapse_dynamics.AbstractPlasticSynapseDynamics
,spynnaker.pyNN.models.abstract_models.abstract_settable.AbstractSettable
,spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun
,spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_generate_on_machine.AbstractGenerateOnMachine
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
dendritic_delay_fraction
¶
-
gen_matrix_id
¶ The ID of the on-machine matrix generator
Return type: int
-
gen_matrix_params
¶ Any parameters required by the matrix generator
Return type: numpy array of uint32
-
gen_matrix_params_size_in_bytes
¶ The size of the parameters of the matrix generator in bytes
Return type: int
-
get_max_synapses
(n_words)[source]¶ Get the maximum number of synapses that can be held in the given number of words
Parameters: n_words – The number of words the synapses must fit in Return type: int
-
get_n_fixed_plastic_words_per_row
(fp_size)[source]¶ Get the number of fixed plastic words to be read from each row
-
get_n_plastic_plastic_words_per_row
(pp_size)[source]¶ Get the number of plastic plastic words to be read from each row
-
get_n_synapses_in_rows
(pp_size, fp_size)[source]¶ Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.
-
get_provenance_data
(pre_population_label, post_population_label)[source]¶ Get the provenance data from this synapse dynamics object
-
mark_no_changes
()[source]¶ Marks the point after which changes are reported, so that new changes can be detected before the next check. Marks the point after which changes are reported. Immediately after calling this method, requires_mapping should return False.
-
read_plastic_synaptic_data
(post_vertex_slice, n_synapse_types, pp_size, pp_data, fp_size, fp_data)[source]¶ Read the connections indicated in the connection indices from the data in pp_data and fp_data
-
requires_mapping
()[source]¶ True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.
Return type: bool True if changes that have been made require that mapping be performed. Note that this should return True the first time it is called, as the vertex must require mapping as it has been created!
-
set_value
(key, value)[source]¶ Set a property
Parameters: - key – the name of the parameter to change
- value – the new value of the parameter to assign Set a property
- key – the name of the parameter to change
- value – the new value of the parameter to assign
-
timing_dependence
¶
-
weight_dependence
¶
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
AbstractSynapseDynamicsStructural
[source]¶ Bases:
object
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
StructuralDynamics
(slow=None, fast=None, structure=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.pynn_synapse_dynamics.PyNNSynapseDynamics
-
structure
¶
-
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
SynapseDynamicsStructuralCommon
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ -
Common class that enables synaptic rewiring. It acts as a wrapper around SynapseDynamicsStatic or SynapseDynamicsSTDP. This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
actual_sdram_usage
¶ Actual SDRAM usage (based on what is written to spec).
Returns: actual SDRAM usage Return type: int
-
default_parameters
= {'delay': 1, 'f_rew': 10000, 'grid': array([16, 16]), 'lateral_inhibition': 0, 'p_elim_dep': 0.0245, 'p_elim_pot': 0.00013600000000000003, 'p_form_forward': 0.16, 'p_form_lateral': 1.0, 'random_partner': False, 's_max': 32, 'sigma_form_forward': 2.5, 'sigma_form_lateral': 1, 'stdp_model': None, 'weight': 0}¶
-
distance
(x0, x1, grid=array([16, 16]), type='euclidian')[source]¶ Compute the distance between points x0 and x1 place on the grid using periodic boundary conditions.
Parameters: - x0 (np.ndarray of ints) – first point in space
- x1 (np.ndarray of ints) – second point in space
- grid (np.ndarray of ints) – shape of grid
- type (str) – distance metric, i.e. euclidian or manhattan
Returns: the distance
Return type: float
-
generate_distance_probability_array
(probability, sigma)[source]¶ Generate the exponentially decaying probability LUTs.
Parameters: - probability (float) – peak probability
- sigma (float) – spread
Returns: distance-dependent probabilities
Return type: numpy.ndarray(float)
-
get_extra_sdram_usage_in_bytes
(machine_in_edges)[source]¶ Better approximation of SDRAM usage based on incoming machine edges
Parameters: machine_in_edges (machine edges) – incoming machine edges Returns: SDRAM usage Return type: int
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Approximate SDRAM usage
Parameters: - n_neurons (int) – number of neurons
- n_synapse_types (int) – number of synapse types (i.e. excitatory and inhibitory)
- in_edges (edges) – incoming edges
Returns: SDRAM usage
Return type: int
-
p_rew
¶ The period of rewiring.
Returns: The period of rewiring Return type: int
-
synaptic_data_update
(connections, post_vertex_slice, app_edge, machine_edge)[source]¶ Get static synaptic data
-
weight_dynamics
¶
-
write_parameters
(spec, region, machine_time_step, weight_scales, application_graph, machine_graph, app_vertex, post_slice, machine_vertex, graph_mapper, routing_info)[source]¶ Write the synapse parameters to the spec.
Parameters: - spec (spec) – the data spec
- region (int) – memory region
- machine_time_step (int) – the duration of a machine time step (ms)
- weight_scales (list(float)) – scaling the weights
- application_graph (
ApplicationGraph
) – the entire, highest level, graph of the network to be simulated - machine_graph (
MachineGraph
) – the entire, lowest level, graph of the network to be simulated - app_vertex (
ApplicationVertex
) – the highest level object of the post-synaptic population - post_slice (
Slice
) – the slice of the app vertex corresponding to this machine vertex - machine_vertex (
MachineVertex
) – the lowest level object of the post-synaptic population - graph_mapper (
GraphMapper
) – for looking up application vertices - routing_info (
RoutingInfo
) – All of the routing information on the network
Returns: None
Return type: None
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
SynapseDynamicsStructuralStatic
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics_structural.AbstractSynapseDynamicsStructural
,spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_static.SynapseDynamicsStatic
- Class that enables synaptic rewiring. It acts as a wrapper around SynapseDynamicsStatic.
This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.
Example usage to allow rewiring in parallel with STDP:
stdp_model = sim.STDPMechanism(...) structure_model_with_stdp = sim.StructuralMechanismStatic( weight=0, s_max=32, grid=[np.sqrt(pop_size), np.sqrt(pop_size)], random_partner=True, f_rew=10 ** 4, # Hz sigma_form_forward=1., delay=10 ) plastic_projection = sim.Projection( ..., synapse_dynamics=sim.SynapseDynamics( slow=structure_model_with_stdp ) )
Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
changes_during_run
¶ Determine if the synapses change during a run
Return type: bool
-
get_n_words_for_static_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_static_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, app_edge, machine_edge)[source]¶ Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.
-
class
spynnaker.pyNN.models.neuron.synapse_dynamics.
SynapseDynamicsStructuralSTDP
(stdp_model=None, f_rew=10000, weight=0, delay=1, s_max=32, sigma_form_forward=2.5, sigma_form_lateral=1, p_form_forward=0.16, p_form_lateral=1.0, p_elim_dep=0.0245, p_elim_pot=0.00013600000000000003, grid=array([16, 16]), lateral_inhibition=0, random_partner=False, seed=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.synapse_dynamics.abstract_synapse_dynamics_structural.AbstractSynapseDynamicsStructural
,spynnaker.pyNN.models.neuron.synapse_dynamics.synapse_dynamics_stdp.SynapseDynamicsSTDP
- Class that enables synaptic rewiring. It acts as a wrapper
around SynapseDynamicsSTDP. This means rewiring can operate in parallel with these types of synapses.
Written by Petrut Bogdan.
Example usage to allow rewiring in parallel with STDP:
stdp_model = sim.STDPMechanism(...) structure_model_with_stdp = sim.StructuralMechanismSTDP( stdp_model=stdp_model, weight=0, s_max=32, grid=[np.sqrt(pop_size), np.sqrt(pop_size)], random_partner=True, f_rew=10 ** 4, # Hz sigma_form_forward=1., delay=10 ) plastic_projection = sim.Projection( ..., synapse_dynamics=sim.SynapseDynamics( slow=structure_model_with_stdp ) )
Parameters: - f_rew (int) – Frequency of rewiring (Hz). How many rewiring attempts will be done per second.
- weight (float) – Initial weight assigned to a newly formed connection
- delay (int) – Delay assigned to a newly formed connection
- s_max (int) – Maximum fan-in per target layer neuron
- sigma_form_forward (float) – Spread of feed-forward formation receptive field
- sigma_form_lateral (float) – Spread of lateral formation receptive field
- p_form_forward (float) – Peak probability for feed-forward formation
- p_form_lateral (float) – Peak probability for lateral formation
- p_elim_pot (float) – Probability of elimination of a potentiated synapse
- p_elim_dep (float) – Probability of elimination of a depressed synapse
- grid (2d int array) – Grid shape
- lateral_inhibition (bool) – Flag whether to mark synapses formed within a layer as inhibitory or excitatory
- random_partner (bool) – Flag whether to randomly select pre-synaptic partner for formation
- seed (int) – seed the random number generators
-
get_n_words_for_plastic_connections
(n_connections)[source]¶ Get the number of 32-bit words for n_connections in a single row
-
get_parameter_names
()[source]¶ Get the parameter names available from the synapse dynamics components
Return type: iterable(str)
-
get_parameters_sdram_usage_in_bytes
(n_neurons, n_synapse_types, in_edges)[source]¶ Get the SDRAM usage of the synapse dynamics parameters in bytes
-
get_plastic_synaptic_data
(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, app_edge, machine_edge)[source]¶ Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.
Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.
Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.