parameters.SimulationParameter

class parameters.SimulationParameter(data: typing.Optional[typing.Any] = None, family: typing.Optional[str] = None, init_func: typing.Optional[typing.Callable[[typing.Any], typing.Any]] = None, shape: typing.Optional[typing.Union[typing.List[typing.Tuple], typing.Tuple, int]] = None, permit_reshape: bool = True, cast_fn: typing.Callable[[typing.Any], typing.Any] = <function ParameterBase.<lambda>>)[source]

Bases: parameters.ParameterBase

Represent a module simulation parameter

A SimulationParameter in Rockpool is a simulation-specific configuration value, which is only needed to control the simulation of a network, but is not needed to communicate your network configuration to someone else. For example, the simulation time-step your solver uses to simulate the dynamics of a module. SimulationParameter s are basically never trainable parameters.

See also

See Parameter for representing the configuration of a module, and State for representing the transient internal state of a neuron or module.

__init__(data: typing.Optional[typing.Any] = None, family: typing.Optional[str] = None, init_func: typing.Optional[typing.Callable[[typing.Any], typing.Any]] = None, shape: typing.Optional[typing.Union[typing.List[typing.Tuple], typing.Tuple, int]] = None, permit_reshape: bool = True, cast_fn: typing.Callable[[typing.Any], typing.Any] = <function ParameterBase.<lambda>>)

Instantiate a Rockpool registered attribute

Parameters
  • data (Optional[Any]) – Concrete initialisation data for this attribute. The shape of data will specify the allowable shape of the attribute data, unless the shape argument is provided.

  • family (Optional[str]) – An arbitrary string to specify the β€œfamily” of this attribute. You should use 'weights', 'taus', 'biases' if you can; otherwise you can use whatever you like. These are used by the Module.parameters(), Module.state() and Module.simulation_parameters() methods to group and select attributes.

  • init_func (Optional[Callable]) – A function that initialises this attributed. Called by Module.reset_parameters() and Module.reset_state(). The signature is f(shape: tuple) -> np.ndarray.

  • shape (Optional[Union[List[Tuple], Tuple, int]]) – A list of permisable shapes for the parameter, or a tuple specifying the permitted shape, or an integer specifying the number of elements. If not provided, the shape of the concrete initialisation data will be used as the attribute shape. The first item in the list will be used as the concrete shape, if data is not provided and init_func should be used.

  • permit_reshape (bool) – If True, the input data will be reshaped to a matching permitted shape. If False, then an error will be raised if the shapes do not match exactly.

  • cast_fn (Optional[Callable]) – A function to call to cast the data for this parameter. Will only be called once on initialisation.

Methods overview

__init__([data,Β family,Β init_func,Β shape,Β ...])

Instantiate a Rockpool registered attribute

__init__(data: typing.Optional[typing.Any] = None, family: typing.Optional[str] = None, init_func: typing.Optional[typing.Callable[[typing.Any], typing.Any]] = None, shape: typing.Optional[typing.Union[typing.List[typing.Tuple], typing.Tuple, int]] = None, permit_reshape: bool = True, cast_fn: typing.Callable[[typing.Any], typing.Any] = <function ParameterBase.<lambda>>)

Instantiate a Rockpool registered attribute

Parameters
  • data (Optional[Any]) – Concrete initialisation data for this attribute. The shape of data will specify the allowable shape of the attribute data, unless the shape argument is provided.

  • family (Optional[str]) – An arbitrary string to specify the β€œfamily” of this attribute. You should use 'weights', 'taus', 'biases' if you can; otherwise you can use whatever you like. These are used by the Module.parameters(), Module.state() and Module.simulation_parameters() methods to group and select attributes.

  • init_func (Optional[Callable]) – A function that initialises this attributed. Called by Module.reset_parameters() and Module.reset_state(). The signature is f(shape: tuple) -> np.ndarray.

  • shape (Optional[Union[List[Tuple], Tuple, int]]) – A list of permisable shapes for the parameter, or a tuple specifying the permitted shape, or an integer specifying the number of elements. If not provided, the shape of the concrete initialisation data will be used as the attribute shape. The first item in the list will be used as the concrete shape, if data is not provided and init_func should be used.

  • permit_reshape (bool) – If True, the input data will be reshaped to a matching permitted shape. If False, then an error will be raised if the shapes do not match exactly.

  • cast_fn (Optional[Callable]) – A function to call to cast the data for this parameter. Will only be called once on initialisation.

_tree_flatten() Tuple[tuple, tuple]

FLatten this parameter / state for Jax

classmethod _tree_unflatten(_, children)

Unflatten a tree of parameter from Jax to Rockpool