spynnaker.pyNN.models.neuron.implementations package¶
Module contents¶
-
class
spynnaker.pyNN.models.neuron.implementations.
AbstractNeuronImpl
[source]¶ Bases:
object
An abstraction of a whole neuron model including all parts
-
add_parameters
(parameters)[source]¶ Add the initial values of the parameters to the parameter holder
Parameters: parameters (RangeDictionary) – A holder of the parameters
-
add_state_variables
(state_variables)[source]¶ Add the initial values of the state variables to the state variables holder
Parameters: state_variables (RangeDictionary) – A holder of the state variables
-
binary_name
¶ The name of the binary executable of this implementation
:rtype str
-
get_data
(parameters, state_variables, vertex_slice)[source]¶ Get the data to be written to the machine for this model
Parameters: - parameters (RangeDictionary) – The holder of the parameters
- state_variables (RangeDictionary) – The holder of the state variables
- vertex_slice (Slice) – The slice of the vertex to generate parameters for
Return type: ndarray(uint32)
-
get_dtcm_usage_in_bytes
(n_neurons)[source]¶ Get the DTCM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_n_cpu_cycles
(n_neurons)[source]¶ Get the number of CPU cycles required to update the state
Parameters: n_neurons (int) – The number of neurons to get the cycles for Return type: int
-
get_n_synapse_types
()[source]¶ Get the number of synapse types supported by the model
Return type: int
-
get_recordable_data_types
()[source]¶ Get the data type of the variables that can be recorded
Returns: dict of name of variable to DataType of variable
-
get_recordable_units
(variable)[source]¶ Get the units of the given variable that can be recorded
Parameters: variable (str) – The name of the variable
-
get_recordable_variable_index
(variable)[source]¶ Get the index of the variable in the list of variables that can be recorded
Parameters: variable (str) – The name of the variable Return type: int
-
get_recordable_variables
()[source]¶ Get the names of the variables that can be recorded in this model
Return type: list(str)
-
get_sdram_usage_in_bytes
(n_neurons)[source]¶ Get the SDRAM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_synapse_id_by_target
(target)[source]¶ Get the ID of a synapse given the name
Parameters: target (str) – The name of the synapse Return type: int
-
get_units
(variable)[source]¶ Get the units of the given variable
Parameters: variable (str) – The name of the variable
-
is_recordable
(variable)[source]¶ Determine if the given variable can be recorded
Parameters: variable (str) – The name of the variable Return type: bool
-
read_data
(data, offset, vertex_slice, parameters, state_variables)[source]¶ Read the parameters and state variables of the model from the given data (read from the machine)
Parameters: - data (bytearray or bytes or memoryview) – The data to be read
- offset (int) – The offset where the data should be read from
- vertex_slice (Slice) – The slice of the vertex to read parameters for
- parameters (RangeDictionary) – The holder of the parameters to update
- state_variables (RangeDictionary) – The holder of the state variables to update
-
-
class
spynnaker.pyNN.models.neuron.implementations.
AbstractStandardNeuronComponent
(data_types)[source]¶ Bases:
object
Represents a component of a standard neural model.
Parameters: data_types (list(DataType)) – A list of data types in the component structure, in the order that they appear -
add_parameters
(parameters)[source]¶ Add the initial values of the parameters to the parameter holder
Parameters: parameters (RangeDictionary) – A holder of the parameters
-
add_state_variables
(state_variables)[source]¶ Add the initial values of the state variables to the state variables holder
Parameters: state_variables (RangeDictionary) – A holder of the state variables
-
get_data
(parameters, state_variables, vertex_slice, ts)[source]¶ Get the data to be written to the machine for this model.
Parameters: - parameters (RangeDictionary) – The holder of the parameters
- state_variables (RangeDictionary) – The holder of the state variables
- vertex_slice (Slice) – The slice of the vertex to generate parameters for
Return type: ndarray(uint32)
-
get_dtcm_usage_in_bytes
(n_neurons)[source]¶ Get the DTCM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_n_cpu_cycles
(n_neurons)[source]¶ Get the number of CPU cycles required to update the state
Parameters: n_neurons (int) – The number of neurons to get the cycles for Return type: int
-
get_sdram_usage_in_bytes
(n_neurons)[source]¶ Get the SDRAM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_units
(variable)[source]¶ Get the units of the given variable
Parameters: variable (str) – The name of the variable
-
get_values
(parameters, state_variables, vertex_slice, ts)[source]¶ Get the values to be written to the machine for this model
Parameters: - parameters (RangeDictionary) – The holder of the parameters
- state_variables (RangeDictionary) – The holder of the state variables
- vertex_slice (Slice) – The slice of variables being retrieved
- ts (float) – The time to be advanced in one call to the update of this component
Returns: A list with the same length as self.struct.field_types
Return type: list(int or float or list(int) or list(float) or RangedList)
-
has_variable
(variable)[source]¶ Determine if this component has a variable by the given name
Parameters: variable (str) – The name of the variable Return type: bool
-
read_data
(data, offset, vertex_slice, parameters, state_variables)[source]¶ Read the parameters and state variables of the model from the given data (read from the machine)
Parameters: - data (bytes or bytearray) – The data to be read
- offset (int) – The offset where the data should be read from
- vertex_slice (Slice) – The slice of the vertex to read parameters for
- parameters (RangeDictionary) – The holder of the parameters to update
- state_variables (RangeDictionary) – The holder of the state variables to update
Returns: The offset after reading the data
Return type:
-
struct
¶ The structure of the component. This structure will have copies in both SDRAM (the initialisation values) and DTCM (the working copy).
Return type: Struct
-
update_values
(values, parameters, state_variables)[source]¶ Update the parameters and state variables with the given struct values that have been read from the machine
Parameters: - values (list(list)) – The values read from the machine, one for each struct element
- parameters (RangeDictionary) – The holder of the parameters to update
- state_variables (RangeDictionary) – The holder of the state variables to update
-
-
class
spynnaker.pyNN.models.neuron.implementations.
NeuronImplStandard
(model_name, binary, neuron_model, input_type, synapse_type, threshold_type, additional_input_type=None)[source]¶ Bases:
spynnaker.pyNN.models.neuron.implementations.abstract_neuron_impl.AbstractNeuronImpl
The standard componentised neuron implementation.
Parameters: - model_name (str) –
- binary (str) –
- neuron_model (AbstractNeuronModel) –
- input_type (AbstractInputType) –
- synapse_type (AbstractSynapseType) –
- threshold_type (AbstractThresholdType) –
- additional_input_type (AbstractAdditionalInput or None) –
-
add_parameters
(parameters)[source]¶ Add the initial values of the parameters to the parameter holder
Parameters: parameters (RangeDictionary) – A holder of the parameters
-
add_state_variables
(state_variables)[source]¶ Add the initial values of the state variables to the state variables holder
Parameters: state_variables (RangeDictionary) – A holder of the state variables
-
binary_name
¶ The name of the binary executable of this implementation
:rtype str
-
get_data
(parameters, state_variables, vertex_slice)[source]¶ Get the data to be written to the machine for this model
Parameters: - parameters (RangeDictionary) – The holder of the parameters
- state_variables (RangeDictionary) – The holder of the state variables
- vertex_slice (Slice) – The slice of the vertex to generate parameters for
Return type: ndarray(uint32)
-
get_dtcm_usage_in_bytes
(n_neurons)[source]¶ Get the DTCM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_n_cpu_cycles
(n_neurons)[source]¶ Get the number of CPU cycles required to update the state
Parameters: n_neurons (int) – The number of neurons to get the cycles for Return type: int
-
get_n_synapse_types
()[source]¶ Get the number of synapse types supported by the model
Return type: int
-
get_recordable_data_types
()[source]¶ Get the data type of the variables that can be recorded
Returns: dict of name of variable to DataType of variable
-
get_recordable_units
(variable)[source]¶ Get the units of the given variable that can be recorded
Parameters: variable (str) – The name of the variable
-
get_recordable_variable_index
(variable)[source]¶ Get the index of the variable in the list of variables that can be recorded
Parameters: variable (str) – The name of the variable Return type: int
-
get_recordable_variables
()[source]¶ Get the names of the variables that can be recorded in this model
Return type: list(str)
-
get_sdram_usage_in_bytes
(n_neurons)[source]¶ Get the SDRAM memory usage required
Parameters: n_neurons (int) – The number of neurons to get the usage for Return type: int
-
get_synapse_id_by_target
(target)[source]¶ Get the ID of a synapse given the name
Parameters: target (str) – The name of the synapse Return type: int
-
get_units
(variable)[source]¶ Get the units of the given variable
Parameters: variable (str) – The name of the variable
-
is_recordable
(variable)[source]¶ Determine if the given variable can be recorded
Parameters: variable (str) – The name of the variable Return type: bool
-
n_steps_per_timestep
¶
-
read_data
(data, offset, vertex_slice, parameters, state_variables)[source]¶ Read the parameters and state variables of the model from the given data (read from the machine)
Parameters: - data (bytearray or bytes or memoryview) – The data to be read
- offset (int) – The offset where the data should be read from
- vertex_slice (Slice) – The slice of the vertex to read parameters for
- parameters (RangeDictionary) – The holder of the parameters to update
- state_variables (RangeDictionary) – The holder of the state variables to update
-
class
spynnaker.pyNN.models.neuron.implementations.
RangedDictVertexSlice
(ranged_dict, vertex_slice)[source]¶ Bases:
object
A slice of a ranged dict to be used to update values
Parameters: - ranged_dict (RangeDictionary) –
- vertex_slice (Slice) –