spynnaker.pyNN.models.neural_projections.connectors package¶
Module contents¶
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractConnector(safe=True, callback=None, verbose=False)¶
Bases:
object
Abstract class that all PyNN Connectors extend.
- Parameters:
- NUMPY_SYNAPSES_DTYPE = [('source', 'uint32'), ('target', 'uint16'), ('weight', 'float64'), ('delay', 'float64'), ('synapse_type', 'uint8')]¶
- connect(projection)[source]¶
Apply this connector to a projection.
Warning
Do not call this! SpyNNaker does not work that way.
- Parameters:
projection (Projection) –
- Raises:
SpynnakerException – Always. Method not supported; profiled out.
- get_connected_vertices(s_info, source_vertex, target_vertex)[source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- abstract get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- abstract get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- abstract get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- abstract get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_provenance_data(synapse_info)[source]¶
- Parameters:
synapse_info (SynapseInformation) –
- abstract get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_mean(weights, synapse_info)[source]¶
Get the mean of the weights.
- Parameters:
weights (RandomDistribution or int or float or str) –
- Return type:
- get_weight_variance(weights, synapse_info)[source]¶
Get the variance of the weights.
- Parameters:
weights (RandomDistribution or int or float or str) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- set_space(space)[source]¶
Set the space object (allowed after instantiation).
- Parameters:
space (Space) –
- property synapse_info¶
The synapse_info object (may be updated after instantiation).
- Return type:
synapse_info or None
- use_direct_matrix(synapse_info)[source]¶
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnHost¶
Bases:
object
A connector that can be generated on host.
- abstract create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnMachine(safe=True, callback=None, verbose=False)¶
Bases:
AbstractConnector
Indicates that the connectivity can be generated on the machine.
- Parameters:
- abstract property gen_connector_id¶
The ID of the connection generator on the machine.
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- gen_delay_params(delays)[source]¶
Get the parameters of the delay generator on the machine.
- Parameters:
delays (RandomDistribution or int or float) –
- Return type:
ndarray(uint32)
- gen_delay_params_size_in_bytes(delays)[source]¶
The size of the delay parameters in bytes.
- Parameters:
delays (RandomDistribution or int or float) –
- Return type:
- gen_delays_id(delays)[source]¶
Get the id of the delay generator on the machine.
- Parameters:
delays (RandomDistribution or int or float) –
- Return type:
- gen_weight_params_size_in_bytes(weights)[source]¶
The size of the weight parameters in bytes.
- Parameters:
weights (RandomDistribution or int or float) –
- Return type:
- gen_weights_params(weights)[source]¶
Get the parameters of the weight generator on the machine.
- Parameters:
weights (RandomDistribution or int or float) –
- Return type:
ndarray(uint32)
- generate_on_machine(weights, delays)[source]¶
Determine if this instance can generate on the machine.
Default implementation returns True if the weights and delays can be generated on the machine
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.AllToAllConnector(allow_self_connections=True, safe=True, verbose=None, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Connects all cells in the presynaptic population to all cells in the postsynaptic population.
- Parameters:
allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
safe (bool) – If
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.ArrayConnector(array, safe=True, callback=None, verbose=False)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
Make connections using an array of integers based on the IDs of the neurons in the pre- and post-populations.
- Parameters:
array (ndarray(2, uint8)) – An explicit boolean matrix that specifies the connections between the pre- and post-populations (see PyNN documentation). Must be 2D in practice.
safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.CSAConnector(cset, safe=True, callback=None, verbose=False)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
Make connections using a Connection Set Algebra (Djurfeldt 2012) description between the neurons in the pre- and post-populations.
Note
If you get TypeError in Python 3 see: https://github.com/INCF/csa/issues/10
- Parameters:
cset (csa.connset.CSet) – A description of the connection set between populations
safe (bool) – If
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- Raises:
ImportError – if the csa library isn’t present; it’s tricky to install in some environments so we don’t force it to be present unless you want to actually use this class.
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.ConvolutionConnector(kernel_weights, kernel_shape=None, strides=None, padding=None, pool_shape=None, pool_stride=None, positive_receptor_type='excitatory', negative_receptor_type='inhibitory', safe=True, verbose=False, callback=None)¶
Bases:
AbstractConnector
Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, column) neuron to many pre(row, column, kernel) through a (kernel) set of weights and/or delays.
- Parameters:
kernel_weights (int or list or ndarray or RandomDistribution) –
The synaptic strengths, shared by neurons in the post population. Can be:
single value: kernel_shape must be provided; the same value will be used for all weights
simple list: kernel_shape must be provided; the list must be sized shape width * height
2D list: If kernel_shape is provided, it must match
ndarray
: As above for simple or 2D listRandomDistribution
: kernel_shape must be provided; weights will be drawn from the distribution
kernel_shape (int or tuple(int,int)) – The shape of the kernel if it cannot be determined from kernel_weights. If a single value is provided, a square kernel will be assumed. If two values are provided, it will be assumed to be (n_rows, n_columns)
strides (int or tuple(int, int)) – Spatial sampling frequency, jumps between the post neurons. This matches the meaning of standard ML packages. If a single value is provided, the same stride will be used for rows and columns. If two values are provided it will be assumed to be (stride_rows, stride_columns)
padding (bool or int or tuple(int, int) or None) – How many ‘extra pixels’ around the pre-population will be added, only zero-valued pixels are currently supported. If a single value is provided, the same padding will be used for rows and columns. If two values are provided it will be assumed to be (padding_rows, padding_columns). If True, automatic padding will be used based on the kernel shape. If False or None, no padding will be used.
pool_shape (int or tuple(int, int) or None) – Area of pooling, only average pooling is supported (and seems to make sense). If a single value is provided, the pooling area will be square. If two values are provided it will be assumed to be (pooling_rows, pooling_columns).
pool_stride (int or tuple(int, int) or None) – Jumps between pooling regions. If a single value is provided, the same stride will be used for rows and columns. If two values are provided it will be assumed to be (stride_rows, stride_columns)
positive_receptor_type (str) – The receptor type to add the positive weights to. By default this is “
excitatory
”.negative_receptor_type (str) – The receptor type to add the negative weights to. By default this is “
inhibitory
”.safe (bool) – (ignored)
verbose (bool) – (ignored)
callback (callable) – (ignored)
- get_connected_vertices(s_info, source_vertex, target_vertex)[source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- property kernel_n_bytes¶
- property kernel_n_weights¶
- property kernel_weights¶
- property negative_receptor_type¶
- property parameters_n_bytes¶
- property positive_receptor_type¶
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None, rng=None, callback=None)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
Make connections using a distribution which varies with distance.
- Parameters:
d_expression (str) – the right-hand side of a valid python expression for probability, involving
d
, (e.g."exp(-abs(d))"
, or"d < 3"
), that can be parsed byeval()
, that computes the distance dependent distribution.allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
safe (bool) – if
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
n_connections (int or None) – The number of efferent synaptic connections per neuron.
rng (NumpyRNG or None) – Seeded random number generator, or
None
to make one when needed.callback (callable) –
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPostConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Connects a fixed number of post-synaptic neurons selected at random, to all pre-synaptic neurons.
- Parameters:
n (int) – number of random post-synaptic neurons connected to pre-neurons.
allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
safe (bool) – Whether to check that weights and delays have valid values; if
False
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
with_replacement (bool) – this flag determines how the random selection of post-synaptic neurons is performed; if
True
, then every post-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; ifFalse
, then once a post-synaptic neuron has been connected to a pre-neuron, it can’t be connected again.rng (NumpyRNG or None) – Seeded random number generator, or
None
to make one when needed.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property allow_self_connections¶
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPreConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Connects a fixed number of pre-synaptic neurons selected at random, to all post-synaptic neurons.
- Parameters:
n (int) – number of random pre-synaptic neurons connected to output
allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
safe (bool) – Whether to check that weights and delays have valid values. If
False
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
with_replacement (bool) – this flag determines how the random selection of pre-synaptic neurons is performed; if true, then every pre-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; if false, then once a pre-synaptic neuron has been connected to a post-neuron, it can’t be connected again.
rng (NumpyRNG or None) – Seeded random number generator, or None to make one when needed
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property allow_self_connections¶
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FixedProbabilityConnector(p_connect, allow_self_connections=True, safe=True, verbose=False, rng=None, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
For each pair of pre-post cells, the connection probability is constant.
- Parameters:
p_connect (float) – a value between zero and one. Each potential connection is created with this probability.
allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
safe (bool) – If
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
rng (NumpyRNG or None) – Seeded random number generator, or None to make one when needed
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- property p_connect¶
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FromFileConnector(file, distributed=False, safe=True, callback=None, verbose=False)¶
Bases:
FromListConnector
Make connections according to a list read from a file.
- Parameters:
Either an open file object or the filename of a file containing a list of connections, in the format required by
FromListConnector
. Column headers, if included in the file, must be specified using a list or tuple, e.g.:# columns = ["i", "j", "weight", "delay", "U", "tau_rec"]
Note
The header requires # at the beginning of the line.
distributed (bool) –
Basic pyNN says:
if this is
True
, then each node will read connections from a file calledfilename.x
, wherex
is the MPI rank. This speeds up loading connections for distributed simulations.Note
Always leave this as
False
with sPyNNaker, which is not MPI-based.safe (bool) – Whether to check that weights and delays have valid values. If
False
, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- class spynnaker.pyNN.models.neural_projections.connectors.FromListConnector(conn_list, safe=True, verbose=False, column_names=None, callback=None)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
Make connections according to a list.
- Parameters:
conn_list (ndarray or list(tuple(int,int,...))) –
A numpy array or a list of tuples, one tuple for each connection. Each tuple should contain:
(pre_idx, post_idx, p1, p2, ..., pn)
where
pre_idx
is the index (i.e. order in the Population, not the ID) of the presynaptic neuron,post_idx
is the index of the postsynaptic neuron, andp1
,p2
, etc. are the synaptic parameters (e.g., weight, delay, plasticity parameters). All tuples/rows must have the same number of items.safe (bool) – if
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
column_names (None or tuple(str) or list(str)) – the names of the parameters
p1
,p2
, etc. If not provided, it is assumed the parameters areweight, delay
(for backwards compatibility).callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property column_names¶
The names of the columns in the array after the first two. Of particular interest is whether
weight
anddelay
columns are present.
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_connected_vertices(s_info, source_vertex, target_vertex)[source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_extra_parameters()[source]¶
Getter for the extra parameters. Excludes
weight
anddelay
columns.- Returns:
The extra parameters
- Return type:
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None, verbose=False)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
Make connections using a probability distribution which varies dependent upon the indices of the pre- and post-populations.
- Parameters:
index_expression (str) – the right-hand side of a valid python expression for probability, involving the indices of the pre- and post-populations, that can be parsed by eval(), that computes a probability distribution; the indices will be given as variables
i
andj
when the expression is evaluated.allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
rng (NumpyRNG or None) – Seeded random number generator, or
None
to make one when needed.safe (bool) – Whether to check that weights and delays have valid values. If
False
, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- property allow_self_connections¶
When the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- Return type:
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.KernelConnector(shape_pre, shape_post, shape_kernel, weight_kernel=None, delay_kernel=None, shape_common=None, pre_sample_steps_in_post=None, pre_start_coords_in_post=None, post_sample_steps_in_pre=None, post_start_coords_in_pre=None, safe=True, space=None, verbose=False, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, column) neuron to many pre(row, column, kernel) through a (kernel) set of weights and/or delays.
TODO
Should these include allow_self_connections and with_replacement?
- Parameters:
shape_pre (list(int) or tuple(int,int)) – 2D shape of the pre-population (rows/height, columns/width, usually the input image shape)
shape_post (list(int) or tuple(int,int)) – 2D shape of the post-population (rows/height, columns/width)
shape_kernel (list(int) or tuple(int,int)) – 2D shape of the kernel (rows/height, columns/width)
weight_kernel (ndarray or RandomDistribution or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the weights
delay_kernel (ndarray or RandomDistribution or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the delays
shape_common (list(int) or tuple(int,int) or None) – (optional) 2D shape of common coordinate system (for both pre- and post-, usually the input image sizes)
pre_sample_steps_in_post (None or list(int) or tuple(int,int)) – (optional) Sampling steps/jumps for pre-population <=> (stepX, stepY)
pre_start_coords_in_post (None or list(int) or tuple(int,int)) – (optional) Starting row/column for pre-population sampling <=> (offX, offY)
post_sample_steps_in_pre (None or list(int) or tuple(int,int)) – (optional) Sampling steps/jumps for post-population <=> (stepX, stepY)
post_start_coords_in_pre (None or list(int) or tuple(int,int)) – (optional) Starting row/column for post-population sampling <=> (offX, offY)
safe (bool) – Whether to check that weights and delays have valid values. If
False
, this check is skipped.space (Space) – Currently ignored; for future compatibility.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
callback (callable) – (ignored)
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_connected_vertices(s_info, source_vertex, target_vertex)[source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.MultapseConnector(n, allow_self_connections=True, with_replacement=True, safe=True, verbose=False, rng=None, callback=None)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Create a multapse connector. The size of the source and destination populations are obtained when the projection is connected. The number of synapses is specified. when instantiated, the required number of synapses is created by selecting at random from the source and target populations with replacement. Uniform selection probability is assumed.
- Parameters:
n (int) – This is the total number of synapses in the connection.
allow_self_connections (bool) – Allow a neuron to connect to itself or not.
with_replacement (bool) – When selecting, allow a neuron to be re-selected or not.
safe (bool) – Whether to check that weights and delays have valid values. If
False
, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
rng (NumpyRNG or None) – Seeded random number generator, or
None
to make one when needed.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.OneToOneConnector(safe=True, callback=None, verbose=False)¶
Bases:
AbstractGenerateConnectorOnMachine
,AbstractGenerateConnectorOnHost
Where the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic population to cell i in the postsynaptic population, for all i.
- Parameters:
safe (bool) – If
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params()[source]¶
Get the parameters of the on machine generation.
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes¶
The size of the connector parameters, in bytes.
- Return type:
- get_connected_vertices(s_info, source_vertex, target_vertex)[source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- use_direct_matrix(synapse_info)[source]¶
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.PoolDenseConnector(weights, pool_shape=None, pool_stride=None, positive_receptor_type='excitatory', negative_receptor_type='inhibitory', safe=True, verbose=False, callback=None)¶
Bases:
AbstractConnector
Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, column) neuron to many pre(row, column, kernel) through a (kernel) set of weights and/or delays.
- Parameters:
weights (int or float or list(int or float) or ndarray or RandomDistribution) –
The synaptic strengths. Can be:
pool_shape (int or tuple(int) or None) – Shape of average pooling. If a single value is provided, it will be used for every dimension, otherwise must be the same number of values as there are dimensions in the source.
pool_stride (int or tuple(int) or None) – Jumps between pooling regions. If a single value is provided, the same stride will be used for all dimensions, otherwise must be the same number of values as there are dimensions in the source. If None, and pool_shape is provided, pool_stride will be set to pool_shape.
positive_receptor_type (str) – The receptor type to add the positive weights to. By default this is “excitatory”.
negative_receptor_type (str) – The receptor type to add the negative weights to. By default this is “inhibitory”.
safe (bool) – (ignored)
verbose (bool) – (ignored)
callback (callable) – (ignored)
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- validate_connection(application_edge, synapse_info)[source]¶
Checks that the edge supports the connector. By default this does nothing i.e. assumes the edge is OK, but can be overridden if the connector has rules that need to be checked. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.SmallWorldConnector(degree, rewiring, allow_self_connections=True, n_connections=None, rng=None, safe=True, callback=None, verbose=False)¶
Bases:
AbstractConnector
,AbstractGenerateConnectorOnHost
A connector that uses connection statistics based on the Small World network connectivity model.
Note
This is typically used from a population to itself.
- Parameters:
degree (float) – the region length where nodes will be connected locally
rewiring (float) – the probability of rewiring each edge
allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
n_connections (int or None) – if specified, the number of efferent synaptic connections per neuron
rng (NumpyRNG or None) – Seeded random number generator, or
None
to make one when needed.safe (bool) – If
True
, check that weights and delays have valid values. IfFalse
, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices, post_vertex_slice, synapse_type, synapse_info)[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice) –
synapse_type (AbstractSynapseType) –
synapse_info (SynapseInformation) –
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info)[source]¶
Get the maximum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- Return type:
int or None
- get_delay_minimum(synapse_info)[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms, synapse_info, min_delay=None, max_delay=None)[source]¶
Get the maximum number of connections from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).
- Parameters:
delays (RandomDistribution or int or float or str) –
n_post_atoms (int) –
synapse_info (SynapseInformation) –
min_delay (int or None) –
max_delay (int or None) –
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info)[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- get_weight_maximum(synapse_info)[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation) –
- Return type:
- set_projection_information(synapse_info)[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info