This page was generated from docs/reference/params_types.ipynb. Interactive online version: Binder badge

Rockpool Parameter handling

Modules in Rockpool use Parameter objects as initialisation arguments to represent trainable parameters of Module s, especially for the audograd backends for Torch and Jax. Non-trainable parameters are represented by SimulationParameter objects as initialisation arguments.

By default, as many parameters as possible are trainable. If you pass a concrete initialisation value for a parameter, it will be initialised to that value (and will also reset to that value), but will nevertheless remain trainable.

However, Rockpool also provides a convenient interface to disable training for a parameter, and fix it to a constant value. If you wrap a concrete initialisation value with the Constant() call, it will force the corresponding parameter to become a constant, non-trainable SimulationParameter .

Typehints in Rockpool

Rockpool provides a typehints package, providing convenient types to integrate into the Python type hinting system for your own code.

P_int

A Rockpool parameter wrapping an int

P_str

A Rockpool parameter wrapping a str

P_float

A Rockpool parameter wrapping a float

P_bool

A Rockpool parameter wrapping a bool

P_tree

A Rockpool parameter wrapping a nested Python iterable

P_tensor

A Rockpool parameter wrapping a torch Tensor

P_ndarray

A Rockpool parameter wrapping a numpy ndarray

P_Callable

A Rockpool parameter wrapping a callable object (e.g. a function)

Tree

A probably nested Python iterable, such as a tuple or nested dict. The root of a tree.

Leaf

A leaf of a tree

Value

A value in a tree leaf

Node

A node (non-leaf) of a tree

FloatVector

A vector of float s (could be a scalar)

IntVector

A vector of int s (could be a scalar)

JaxTreeDef

A Jax tree definition object

JaxRNGKey

a Jax RNG key object