Dynamic#

class brainpy.Dynamic(size, keep_size=False, sharding=None, name=None, mode=None, method='exp_auto')[source]#

Base class to model dynamics.

There are several essential attributes:

  • size: the geometry of the neuron group. For example, (10, ) denotes a line of neurons, (10, 10) denotes a neuron group aligned in a 2D space, (10, 15, 4) denotes a 3-dimensional neuron group.

  • num: the flattened number of neurons in the group. For example, size=(10, ) => num=10, size=(10, 10) => num=100, size=(10, 15, 4) => num=600.

Parameters:
clear_input(*args, **kwargs)[source]#

Empty function of clearing inputs.

init_param(param, shape=None, sharding=None)[source]#

Initialize parameters.

If sharding is provided and param is array, this function will partition the parameter across the default device mesh.

See device_mesh() for the mesh setting.

init_variable(var_data, batch_or_mode, shape=None, sharding=None)[source]#

Initialize variables.

If sharding is provided and var_data is array, this function will partition the variable across the default device mesh.

See device_mesh() for the mesh setting.

update(*args, **kwargs)[source]#

The function to specify the updating rule.

property varshape#

The shape of variables in the neuron group.