spynnaker.pyNN.models.neuron.synapse_dynamics package

Module contents

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractGenerateOnMachine

Bases: object

A synapse dynamics that can be generated on the machine.

abstract property gen_matrix_id

The ID of the on-machine matrix generator.

Return type:

int

abstract gen_matrix_params(synaptic_matrix_offset, delayed_matrix_offset, app_edge, synapse_info, max_row_info, max_pre_atoms_per_core, max_post_atoms_per_core)[source]

Any parameters required by the matrix generator.

Return type:

ndarray(uint32)

abstract property gen_matrix_params_size_in_bytes

The size of the parameters of the matrix generator in bytes.

Return type:

int

generate_on_machine()[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Return type:

bool

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractPlasticSynapseDynamics

Bases: AbstractSDRAMSynapseDynamics

Synapses which change over time.

abstract get_n_fixed_plastic_words_per_row(fp_size)[source]

Get the number of fixed plastic words to be read from each row.

Parameters:

fp_size (ndarray) –

abstract get_n_plastic_plastic_words_per_row(pp_size)[source]

Get the number of plastic plastic words to be read from each row.

Parameters:

pp_size (ndarray) –

abstract 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.

Parameters:
abstract get_n_words_for_plastic_connections(n_connections)[source]

Get the number of 32-bit words for n_connections in a single row.

Parameters:

n_connections (int) –

Return type:

int

abstract get_plastic_synaptic_data(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, max_n_synapses, max_atoms_per_core)[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.

Parameters:
  • connections (ndarray) – The connections to get data for

  • connection_row_indices (ndarray) – The row into which each connection should go

  • n_rows (int) – The total number of rows

  • post_vertex_slice (Slice) – The slice of the post vertex to get the connections for

  • n_synapse_types (int) – The number of synapse types

  • max_n_synapses (int) – The maximum number of synapses to generate

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(fp_data, pp_data, fp_size, pp_size)

Return type:

tuple(ndarray, ndarray, ndarray, ndarray)

abstract read_plastic_synaptic_data(post_vertex_slice, n_synapse_types, pp_size, pp_data, fp_size, fp_data, max_atoms_per_core)[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
Returns:

array with columns source, target, weight, delay

Return type:

ndarray

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSDRAMSynapseDynamics

Bases: AbstractSynapseDynamics

How do the dynamics of a synapse interact with the rest of the model.

NUMPY_CONNECTORS_DTYPE = [('source', 'uint32'), ('target', 'uint32'), ('weight', 'float64'), ('delay', 'float64')]
convert_per_connection_data_to_rows(connection_row_indices, n_rows, data, max_n_synapses)[source]

Converts per-connection data generated from connections into row-based data to be returned from get_synaptic_data.

Parameters:
  • connection_row_indices (ndarray) – The index of the row that each item should go into

  • n_rows (int) – The number of rows

  • data (ndarray) – The non-row-based data

  • max_n_synapses (int) – The maximum number of synapses to generate in each row

Return type:

list(ndarray)

abstract 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 (int) – 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.

Parameters:
Return type:

ndarray

abstract get_parameter_names()[source]

Get the parameter names available from the synapse dynamics components.

Return type:

iterable(str)

abstract get_parameters_sdram_usage_in_bytes(n_neurons, n_synapse_types)[source]

Get the SDRAM usage of the synapse dynamics parameters in bytes.

Parameters:
  • n_neurons (int) –

  • n_synapse_types (int) –

Return type:

int

get_words(rows)[source]

Convert the row data to words.

Parameters:

rows (ndarray) –

Return type:

ndarray

abstract is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

abstract property pad_to_length

The amount each row should pad to, or None if not specified.

abstract write_parameters(spec, region, global_weight_scale, synapse_weight_scales)[source]

Write the synapse parameters to the spec.

Parameters:
  • spec (DataSpecificationGenerator) – The specification to write to

  • region (int) – region ID to write to

  • global_weight_scale (float) – The weight scale applied globally

  • synapse_weight_scales (list(float)) – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractStaticSynapseDynamics

Bases: AbstractSDRAMSynapseDynamics

Dynamics which don’t change over time.

abstract 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.

Parameters:

ff_size (ndarray) –

Return type:

ndarray

abstract get_n_synapses_in_rows(ff_size)[source]

Get the number of synapses in the rows with sizes ff_size.

Parameters:

ff_size (ndarray) –

Return type:

ndarray

abstract get_n_words_for_static_connections(n_connections)[source]

Get the number of 32-bit words for n_connections in a single row.

Parameters:

n_connections (int) –

Return type:

int

abstract get_static_synaptic_data(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, max_n_synapses, max_atoms_per_core)[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.

Parameters:
  • connections (ndarray) – The connections to get data for

  • connection_row_indices (ndarray) – The row into which each connection should go

  • n_rows (int) – The number of rows to write

  • post_vertex_slice (Slice) – The slice of the post vertex to generate for

  • n_synapse_types (int) – The number of synapse types

  • max_n_synapses (int) – The maximum number of synapses to generate

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(ff_data, ff_size)

Return type:

tuple(list(ndarray), ndarray)

abstract read_static_synaptic_data(post_vertex_slice, n_synapse_types, ff_size, ff_data, max_atoms_per_core)[source]

Read the connections from the words of data in ff_data.

Parameters:
Return type:

ndarray

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSupportsSignedWeights

Bases: object

A synapse dynamics object that supports signed weights.

abstract get_maximum_positive_weight(incoming_projection)[source]

Get the maximum likely positive weight.

Note

This must be a value >= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

float

abstract get_mean_negative_weight(incoming_projection)[source]

Get the mean of the negative weights.

Note

This must be a value <= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

float

abstract get_mean_positive_weight(incoming_projection)[source]

Get the mean of the positive weights.

Note

This must be a value >= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

float

abstract get_minimum_negative_weight(incoming_projection)[source]

Get the minimum likely negative weight.

Note

This must be a value <= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

int

abstract get_negative_synapse_index(incoming_projection)[source]

Get the synapse type that negative weights will arrive at.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

int

abstract get_positive_synapse_index(incoming_projection)[source]

Get the synapse type that positive weights will arrive at.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

int

abstract get_variance_negative_weight(incoming_projection)[source]

Get the variance of the negative weights.

Note

This must be a value <= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

float

abstract get_variance_positive_weight(incoming_projection)[source]

Get the variance of the positive weights.

Note

This must be a value >= 0.

Parameters:

incoming_projection (Projection) – The projection targeted

Return type:

float

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSynapseDynamics

Bases: object

How do the dynamics of a synapse interact with the rest of the model.

property absolute_max_atoms_per_core

The absolute maximum number of atoms per core supported by this synapse dynamics object.

Return type:

int

abstract property changes_during_run

Whether the synapses change during a run.

Return type:

bool

abstract property delay

The delay of connections.

Return type:

float

get_connected_vertices(s_info, source_vertex, target_vertex)[source]

Get the machine vertices that are connected to each other with this connector.

Parameters:
Returns:

A list of tuples of (target machine vertex, list of sources)

Return type:

list(tuple(MachineVertex, list(AbstractVertex)))

get_delay_maximum(connector, synapse_info)[source]

Get the maximum delay for the synapses.

Parameters:
get_delay_minimum(connector, synapse_info)[source]

Get the minimum delay for the synapses. This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
get_delay_variance(connector, delays, synapse_info)[source]

Get the variance in delay for the synapses.

Parameters:
get_provenance_data(pre_population_label, post_population_label)[source]

Get the provenance data from this synapse dynamics object.

Parameters:
  • pre_population_label (str) –

  • post_population_label (str) –

Return type:

iterable(ProvenanceDataItem)

get_synapse_id_by_target(target)[source]

Get the index of the synapse type based on the name, or None if the name is not found.

Parameters:

target (str) – The name of the synapse

Return type:

int or None

get_value(key)[source]

Get a property.

Parameters:

key (str) – the name of the property

Return type:

Any or float or int or list(float) or list(int)

abstract get_vertex_executable_suffix()[source]

Get the executable suffix for a vertex for this dynamics.

Return type:

str

get_weight_maximum(connector, synapse_info)[source]

Get the maximum weight for the synapses.

Parameters:
get_weight_mean(connector, synapse_info)[source]

Get the mean weight for the synapses.

Parameters:
get_weight_variance(connector, weights, synapse_info)[source]

Get the variance in weight for the synapses.

Parameters:
abstract property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

abstract merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

set_value(key, value)[source]

Set a property.

Parameters:
  • key (str) – the name of the parameter to change

  • value (Any or float or int or list(float) or list(int)) – the new value of the parameter to assign

abstract property weight

The weight of connections.

Return type:

float

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSynapseDynamicsStructural

Bases: object

abstract check_initial_delay(max_delay_ms)[source]

Check that delays can be done without delay extensions.

Parameters:

max_delay_ms (int) – The maximum delay supported, in milliseconds

Raises:

Exception – if the delay is out of range

abstract property elimination

The elimination rule.

Return type:

AbstractElimination

abstract property f_rew

The frequency of rewiring.

Return type:

float

abstract property formation

The formation rule.

Return type:

AbstractFormation

abstract get_max_rewires_per_ts()[source]

Get the max number of rewires per timestep.

Return type:

int

abstract get_structural_parameters_sdram_usage_in_bytes(incoming_projections, n_neurons)[source]

Get the size of the structural parameters.

Note

At the Application level this will be an estimate.

Parameters:
  • incoming_projections (list(Projection)) – The projections that target the vertex in question

  • n_neurons (int) –

Returns:

the size of the parameters, in bytes

Return type:

int

Raises:

PacmanInvalidParameterException – If the parameters make no sense.

abstract property initial_delay

The delay of a formed connection.

Return type:

float or (float, float)

abstract property initial_weight

The weight of a formed connection.

Return type:

float

abstract property partner_selection

The partner selection rule.

Return type:

AbstractPartnerSelection

abstract property s_max

The maximum number of synapses.

Return type:

int

abstract property seed

The seed to control the randomness.

abstract set_connections(connections, post_vertex_slice, app_edge, synapse_info)[source]

Set connections for structural plasticity.

Parameters:
abstract property with_replacement

Whether to allow replacement when creating synapses.

Return type:

bool

abstract write_structural_parameters(spec, region, weight_scales, app_vertex, vertex_slice, synaptic_matrices)[source]

Write structural plasticity parameters.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • region (int) – region ID

  • weight_scales (list(float)) – Weight scaling for each synapse type

  • app_vertex (ApplicationVertex) – The target application vertex

  • vertex_slice (Slice) – The slice of the target vertex to generate for

  • synaptic_matrices (SynapticMatrices) – The synaptic matrices for this vertex

class spynnaker.pyNN.models.neuron.synapse_dynamics.PyNNSynapseDynamics(slow=None, fast=None)

Bases: object

property slow
class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsNeuromodulation(weight=0.0, tau_c=1000.0, tau_d=200.0, w_min=0.0, w_max=1.0)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

Synapses that target a neuromodulation receptor.

property changes_during_run

Whether the synapses change during a run.

Return type:

bool

property delay

The delay of connections.

Return type:

float

property gen_matrix_id

The ID of the on-machine matrix generator.

Return type:

int

gen_matrix_params(synaptic_matrix_offset, delayed_matrix_offset, app_edge, synapse_info, max_row_info, max_pre_atoms_per_core, max_post_atoms_per_core)[source]

Any parameters required by the matrix generator.

Return type:

ndarray(uint32)

property 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 (int) – 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.

Parameters:

fp_size (ndarray) –

get_n_plastic_plastic_words_per_row(pp_size)[source]

Get the number of plastic plastic words to be read from each row.

Parameters:

pp_size (ndarray) –

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.

Parameters:
get_n_words_for_plastic_connections(n_connections)[source]

Get the number of 32-bit words for n_connections in a single row.

Parameters:

n_connections (int) –

Return type:

int

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.

Parameters:
  • n_neurons (int) –

  • n_synapse_types (int) –

Return type:

int

get_plastic_synaptic_data(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, max_n_synapses, max_atoms_per_core)[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.

Parameters:
  • connections (ndarray) – The connections to get data for

  • connection_row_indices (ndarray) – The row into which each connection should go

  • n_rows (int) – The total number of rows

  • post_vertex_slice (Slice) – The slice of the post vertex to get the connections for

  • n_synapse_types (int) – The number of synapse types

  • max_n_synapses (int) – The maximum number of synapses to generate

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(fp_data, pp_data, fp_size, pp_size)

Return type:

tuple(ndarray, ndarray, ndarray, ndarray)

get_synapse_id_by_target(target)[source]

Get the index of the synapse type based on the name, or None if the name is not found.

Parameters:

target (str) – The name of the synapse

Return type:

int or None

get_value(key)[source]

Get a property.

Parameters:

key (str) – the name of the property

Return type:

Any or float or int or list(float) or list(int)

get_vertex_executable_suffix()[source]

Get the executable suffix for a vertex for this dynamics.

Return type:

str

property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

is_neuromodulation_same_as(other)[source]
is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

property pad_to_length

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(post_vertex_slice, n_synapse_types, pp_size, pp_data, fp_size, fp_data, max_atoms_per_core)[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
Returns:

array with columns source, target, weight, delay

Return type:

ndarray

set_value(key, value)[source]

Set a property.

Parameters:
  • key (str) – the name of the parameter to change

  • value (Any or float or int or list(float) or list(int)) – the new value of the parameter to assign

property tau_c
property tau_d
property w_max
property w_min
property weight

The weight of connections.

Return type:

float

write_parameters(spec, region, global_weight_scale, synapse_weight_scales)[source]

Write the synapse parameters to the spec.

Parameters:
  • spec (DataSpecificationGenerator) – The specification to write to

  • region (int) – region ID to write to

  • global_weight_scale (float) – The weight scale applied globally

  • synapse_weight_scales (list(float)) – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsSTDP(timing_dependence, weight_dependence, voltage_dependence=None, dendritic_delay_fraction=1.0, weight=0.0, delay=None, pad_to_length=None, backprop_delay=True)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

The dynamics of a synapse that changes over time using a Spike Timing Dependent Plasticity (STDP) rule.

Parameters:
property backprop_delay

Settable.

Return type:

bool

property changes_during_run

Whether the synapses change during a run.

Return type:

bool

property delay

The delay of connections.

Return type:

float

property dendritic_delay_fraction

Settable.

Return type:

float

property gen_matrix_id

The ID of the on-machine matrix generator.

Return type:

int

gen_matrix_params(synaptic_matrix_offset, delayed_matrix_offset, app_edge, synapse_info, max_row_info, max_pre_atoms_per_core, max_post_atoms_per_core)[source]

Any parameters required by the matrix generator.

Return type:

ndarray(uint32)

property 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 (int) – 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.

Parameters:

fp_size (ndarray) –

get_n_plastic_plastic_words_per_row(pp_size)[source]

Get the number of plastic plastic words to be read from each row.

Parameters:

pp_size (ndarray) –

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.

Parameters:
get_n_words_for_plastic_connections(n_connections)[source]
Parameters:

n_connections (int) –

Return type:

int

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]
Parameters:
  • n_neurons (int) –

  • n_synapse_types (int) –

Return type:

int

get_plastic_synaptic_data(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, max_n_synapses, max_atoms_per_core)[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.

Parameters:
  • connections (ndarray) – The connections to get data for

  • connection_row_indices (ndarray) – The row into which each connection should go

  • n_rows (int) – The total number of rows

  • post_vertex_slice (Slice) – The slice of the post vertex to get the connections for

  • n_synapse_types (int) – The number of synapse types

  • max_n_synapses (int) – The maximum number of synapses to generate

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(fp_data, pp_data, fp_size, pp_size)

Return type:

tuple(ndarray, ndarray, ndarray, ndarray)

get_value(key)[source]

Get a property.

Parameters:

key (str) – the name of the property

Return type:

Any or float or int or list(float) or list(int)

get_vertex_executable_suffix()[source]
Return type:

str

get_weight_maximum(connector, synapse_info)[source]

Get the maximum weight for the synapses.

Parameters:
get_weight_mean(connector, synapse_info)[source]

Get the mean weight for the synapses.

Parameters:
get_weight_variance(connector, weights, synapse_info)[source]

Get the variance in weight for the synapses.

Parameters:
property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

merge_neuromodulation(neuromodulation)[source]
property neuromodulation
Return type:

SynapseDynamicsNeuromodulation

property pad_to_length

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(post_vertex_slice, n_synapse_types, pp_size, pp_data, fp_size, fp_data, max_atoms_per_core)[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
Returns:

array with columns source, target, weight, delay

Return type:

ndarray

set_value(key, value)[source]

Set a property.

Parameters:
  • key (str) – the name of the parameter to change

  • value (Any or float or int or list(float) or list(int)) – the new value of the parameter to assign

property timing_dependence
Return type:

AbstractTimingDependence

property weight

The weight of connections.

Return type:

float

property weight_dependence
Return type:

AbstractTimingDependence

write_parameters(spec, region, global_weight_scale, synapse_weight_scales)[source]

Write the synapse parameters to the spec.

Parameters:
  • spec (DataSpecificationGenerator) – The specification to write to

  • region (int) – region ID to write to

  • global_weight_scale (float) – The weight scale applied globally

  • synapse_weight_scales (list(float)) – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStatic(weight=0.0, delay=None, pad_to_length=None)

Bases: AbstractStaticSynapseDynamics, AbstractGenerateOnMachine

The dynamics of a synapse that does not change over time.

Parameters:
  • weight (float) –

  • delay (float or None) – Use None to get the simulator default minimum delay.

  • pad_to_length (int) –

property changes_during_run

Whether the synapses change during a run.

Return type:

bool

property delay

The delay of connections.

Return type:

float

property gen_matrix_id

The ID of the on-machine matrix generator.

Return type:

int

gen_matrix_params(synaptic_matrix_offset, delayed_matrix_offset, app_edge, synapse_info, max_row_info, max_pre_atoms_per_core, max_post_atoms_per_core)[source]

Any parameters required by the matrix generator.

Return type:

ndarray(uint32)

property 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 (int) – 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.

Parameters:

ff_size (ndarray) –

Return type:

ndarray

get_n_synapses_in_rows(ff_size)[source]

Get the number of synapses in the rows with sizes ff_size.

Parameters:

ff_size (ndarray) –

Return type:

ndarray

get_n_words_for_static_connections(n_connections)[source]

Get the number of 32-bit words for n_connections in a single row.

Parameters:

n_connections (int) –

Return type:

int

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.

Parameters:
  • n_neurons (int) –

  • n_synapse_types (int) –

Return type:

int

get_static_synaptic_data(connections, connection_row_indices, n_rows, post_vertex_slice, n_synapse_types, max_n_synapses, max_atoms_per_core)[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.

Parameters:
  • connections (ndarray) – The connections to get data for

  • connection_row_indices (ndarray) – The row into which each connection should go

  • n_rows (int) – The number of rows to write

  • post_vertex_slice (Slice) – The slice of the post vertex to generate for

  • n_synapse_types (int) – The number of synapse types

  • max_n_synapses (int) – The maximum number of synapses to generate

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(ff_data, ff_size)

Return type:

tuple(list(ndarray), ndarray)

get_vertex_executable_suffix()[source]

Get the executable suffix for a vertex for this dynamics.

Return type:

str

property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

property pad_to_length

The amount each row should pad to, or None if not specified.

read_static_synaptic_data(post_vertex_slice, n_synapse_types, ff_size, ff_data, max_atoms_per_core)[source]

Read the connections from the words of data in ff_data.

Parameters:
Return type:

ndarray

property weight

The weight of connections.

Return type:

float

write_parameters(spec, region, global_weight_scale, synapse_weight_scales)[source]

Write the synapse parameters to the spec.

Parameters:
  • spec (DataSpecificationGenerator) – The specification to write to

  • region (int) – region ID to write to

  • global_weight_scale (float) – The weight scale applied globally

  • synapse_weight_scales (list(float)) – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralCommon

Bases: AbstractSynapseDynamicsStructural

PAIR_ERROR = 'Only one Projection between each pair of Populations can use structural plasticity'
check_initial_delay(max_delay_ms)[source]

Check that delays can be done without delay extensions.

Parameters:

max_delay_ms (float) – The maximum delay supported, in milliseconds

Raises:

ValueError – if the delay is out of range

abstract property connections

Initial connectivity as defined via connector.

Return type:

dict

get_max_rewires_per_ts()[source]

Get the max number of rewires per timestep.

Return type:

int

get_parameter_names()[source]
Return type:

list(str)

abstract get_seeds(app_vertex=None)[source]

Generate a seed for the RNG on chip that is the same for all of the cores that have perform structural updates.

It should be different between application vertices but the same for the same app_vertex. It should be different every time called with None.

Parameters:

app_vertex (ApplicationVertex or None) –

Returns:

list of random seed (4 words), generated randomly

Return type:

list(int)

get_structural_parameters_sdram_usage_in_bytes(incoming_projections, n_neurons)[source]

Get the size of the structural parameters.

Note

At the Application level this will be an estimate.

Parameters:
  • incoming_projections (list(Projection)) – The projections that target the vertex in question

  • n_neurons (int) –

Returns:

the size of the parameters, in bytes

Return type:

int

Raises:

PacmanInvalidParameterException – If the parameters make no sense.

get_vertex_executable_suffix()[source]
Return type:

str

is_same_as(synapse_dynamics)[source]
Parameters:

synapse_dynamics (SynapseDynamicsStructuralCommon) –

Return type:

bool

property p_rew

The period of rewiring.

Return type:

float

write_structural_parameters(spec, region, weight_scales, app_vertex, vertex_slice, synaptic_matrices)[source]

Write structural plasticity parameters.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • region (int) – region ID

  • weight_scales (list(float)) – Weight scaling for each synapse type

  • app_vertex (ApplicationVertex) – The target application vertex

  • vertex_slice (Slice) – The slice of the target vertex to generate for

  • synaptic_matrices (SynapticMatrices) – The synaptic matrices for this vertex

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralSTDP(partner_selection, formation, elimination, timing_dependence=None, weight_dependence=None, voltage_dependence=None, dendritic_delay_fraction=1.0, f_rew=10000.0, initial_weight=0.0, initial_delay=1.0, s_max=32, with_replacement=True, seed=None, weight=0.0, delay=None, backprop_delay=True)

Bases: SynapseDynamicsSTDP, SynapseDynamicsStructuralCommon

Class that enables synaptic rewiring in the presence of STDP.

It acts as a wrapper around SynapseDynamicsSTDP, meaning rewiring can operate in parallel with STDP synapses.

Written by Petrut Bogdan.

Parameters:
  • partner_selection (AbstractPartnerSelection) – The partner selection rule

  • formation (AbstractFormation) – The formation rule

  • elimination (AbstractElimination) – The elimination rule

  • timing_dependence (AbstractTimingDependence) – The STDP timing dependence rule

  • weight_dependence (AbstractWeightDependence) – The STDP weight dependence rule

  • voltage_dependence (None) – The STDP voltage dependence (unsupported)

  • dendritic_delay_fraction (float) – The STDP dendritic delay fraction

  • f_rew (float) – How many rewiring attempts will be done per second.

  • initial_weight (float) – Weight assigned to a newly formed connection

  • initial_delay (float or tuple(float, float)) – Delay assigned to a newly formed connection; a single value means a fixed delay value, or a tuple of two values means the delay will be chosen at random from a uniform distribution between the given values

  • s_max (int) – Maximum fan-in per target layer neuron

  • with_replacement (bool) – If set to True (default), a new synapse can be formed in a location where a connection already exists; if False, then it must form where no connection already exists

  • seed (int or None) – seed for the random number generators

  • weight (float) – The weight of connections formed by the connector

  • delay (float or None) – The delay of connections formed by the connector Use None to get the simulator default minimum delay.

  • backprop_delay (bool) – Whether back-propagated delays are used

property connections

Initial connectivity as defined via connector.

Return type:

dict

property elimination

The elimination rule.

Return type:

AbstractElimination

property f_rew

The frequency of rewiring.

Return type:

float

property formation

The formation rule.

Return type:

AbstractFormation

generate_on_machine()[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Return type:

bool

get_connected_vertices(s_info, source_vertex, target_vertex)[source]

Get the machine vertices that are connected to each other with this connector.

Parameters:
Returns:

A list of tuples of (target machine vertex, list of sources)

Return type:

list(tuple(MachineVertex, list(AbstractVertex)))

get_delay_maximum(connector, synapse_info)[source]

Get the maximum delay for the synapses.

Parameters:
get_delay_minimum(connector, synapse_info)[source]

Get the minimum delay for the synapses. This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
get_delay_variance(connector, delays, synapse_info)[source]

Get the variance in delay for the synapses.

Parameters:
get_parameter_names()[source]

Get the parameter names available from the synapse dynamics components.

Return type:

iterable(str)

get_seeds(app_vertex=None)[source]

Generate a seed for the RNG on chip that is the same for all of the cores that have perform structural updates.

It should be different between application vertices but the same for the same app_vertex. It should be different every time called with None.

Parameters:

app_vertex (ApplicationVertex or None) –

Returns:

list of random seed (4 words), generated randomly

Return type:

list(int)

get_vertex_executable_suffix()[source]
Return type:

str

get_weight_maximum(connector, synapse_info)[source]

Get the maximum weight for the synapses.

Parameters:
get_weight_mean(connector, synapse_info)[source]

Get the mean weight for the synapses.

Parameters:
property initial_delay

The delay of a formed connection.

Return type:

float or (float, float)

property initial_weight

The weight of a formed connection.

Return type:

float

property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

property partner_selection

The partner selection rule.

Return type:

AbstractPartnerSelection

property s_max

The maximum number of synapses.

Return type:

int

property seed

The seed to control the randomness.

set_connections(connections, post_vertex_slice, app_edge, synapse_info)[source]

Set connections for structural plasticity.

Parameters:
set_projection_parameter(param, value)[source]
Parameters:
  • param (str) –

  • value

property with_replacement

Whether to allow replacement when creating synapses.

Return type:

bool

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralStatic(partner_selection, formation, elimination, f_rew=10000.0, initial_weight=0.0, initial_delay=1.0, s_max=32, with_replacement=True, seed=None, weight=0.0, delay=None)

Bases: SynapseDynamicsStatic, SynapseDynamicsStructuralCommon

Class that enables synaptic rewiring in the absence of STDP.

It acts as a wrapper around SynapseDynamicsStatic, meaning that rewiring can operate in parallel with static synapses.

Written by Petrut Bogdan.

Parameters:
  • partner_selection (AbstractPartnerSelection) – The partner selection rule

  • formation (AbstractFormation) – The formation rule

  • elimination (AbstractElimination) – The elimination rule

  • f_rew (float) – How many rewiring attempts will be done per second.

  • initial_weight (float) – Weight assigned to a newly formed connection

  • initial_delay (float or (float, float)) – Delay assigned to a newly formed connection; a single value means a fixed delay value, or a tuple of two values means the delay will be chosen at random from a uniform distribution between the given values

  • s_max (int) – Maximum fan-in per target layer neuron

  • with_replacement (bool) – If set to True (default), a new synapse can be formed in a location where a connection already exists; if False, then it must form where no connection already exists

  • seed (int) – seed the random number generators

  • weight (float) – The weight of connections formed by the connector

  • delay (float or None) – The delay of connections formed by the connector Use None to get the simulator default minimum delay.

property changes_during_run

Whether the synapses change during a run.

Return type:

bool

property connections

Initial connectivity as defined via connector.

Return type:

dict

property elimination

The elimination rule.

Return type:

AbstractElimination

property f_rew

The frequency of rewiring.

Return type:

float

property formation

The formation rule.

Return type:

AbstractFormation

generate_on_machine()[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Return type:

bool

get_connected_vertices(s_info, source_vertex, target_vertex)[source]

Get the machine vertices that are connected to each other with this connector.

Parameters:
Returns:

A list of tuples of (target machine vertex, list of sources)

Return type:

list(tuple(MachineVertex, list(AbstractVertex)))

get_delay_maximum(connector, synapse_info)[source]

Get the maximum delay for the synapses.

Parameters:
get_delay_minimum(connector, synapse_info)[source]

Get the minimum delay for the synapses. This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
get_delay_variance(connector, delays, synapse_info)[source]

Get the variance in delay for the synapses.

Parameters:
get_parameter_names()[source]

Get the parameter names available from the synapse dynamics components.

Return type:

iterable(str)

get_seeds(app_vertex=None)[source]

Generate a seed for the RNG on chip that is the same for all of the cores that have perform structural updates.

It should be different between application vertices but the same for the same app_vertex. It should be different every time called with None.

Parameters:

app_vertex (ApplicationVertex or None) –

Returns:

list of random seed (4 words), generated randomly

Return type:

list(int)

get_vertex_executable_suffix()[source]

Get the executable suffix for a vertex for this dynamics.

Return type:

str

get_weight_maximum(connector, synapse_info)[source]

Get the maximum weight for the synapses.

Parameters:
get_weight_mean(connector, synapse_info)[source]

Get the mean weight for the synapses.

Parameters:
get_weight_variance(connector, weights, synapse_info)[source]

Get the variance in weight for the synapses.

Parameters:
property initial_delay

The delay of a formed connection.

Return type:

float or (float, float)

property initial_weight

The weight of a formed connection.

Return type:

float

property is_combined_core_capable

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

Return type:

bool

is_same_as(synapse_dynamics)[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

bool

merge(synapse_dynamics)[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) –

Return type:

AbstractSynapseDynamics

property partner_selection

The partner selection rule.

Return type:

AbstractPartnerSelection

property s_max

The maximum number of synapses.

Return type:

int

property seed

The seed to control the randomness.

set_connections(connections, post_vertex_slice, app_edge, synapse_info)[source]

Set connections for structural plasticity.

Parameters:
set_projection_parameter(param, value)[source]
Parameters:
  • param (str) –

  • value

property with_replacement

Whether to allow replacement when creating synapses.

Return type:

bool

spynnaker.pyNN.models.neuron.synapse_dynamics.calculate_spike_pair_additive_stdp_weight(pre_spikes, post_spikes, initial_weight, plastic_delay, a_plus, a_minus, tau_plus, tau_minus)

Calculates the expected STDP weight for SpikePair Additive STDP.

Parameters:
  • pre_spikes (iterable(int)) –

  • post_spikes (iterable(int)) –

  • initial_weight (float) –

  • plastic_delay (int) – parameter of the STDP model

  • a_plus (float) – parameter of the STDP model

  • a_minus (float) – parameter of the STDP model

  • tau_plus (float) – parameter of the STDP model

  • tau_minus (float) – parameter of the STDP model

Returns:

overall weight

Return type:

float

spynnaker.pyNN.models.neuron.synapse_dynamics.calculate_spike_pair_multiplicative_stdp_weight(pre_spikes, post_spikes, initial_weight, plastic_delay, min_weight, max_weight, a_plus, a_minus, tau_plus, tau_minus)

Calculates the expected STDP weight for SpikePair Multiplicative STDP.

Parameters:
  • pre_spikes (iterable(int)) – Spikes going into the model

  • post_spikes (iterable(int)) – Spikes recorded on the model

  • initial_weight (float) – Starting weight for the model

  • plastic_delay (int) – parameter of the STDP model

  • min_weight (float) – parameter of the STDP model

  • max_weight (float) – parameter of the STDP model

  • a_plus (float) – parameter of the STDP model

  • a_minus (float) – parameter of the STDP model

  • tau_plus (float) – parameter of the STDP model

  • tau_minus (float) – parameter of the STDP model

Returns:

overall weight

Return type:

float