brainpy.math.LengthDelay#

class brainpy.math.LengthDelay(delay_target, delay_len, initial_delay_data=None, name=None, batch_axis=None, update_method='rotation')[source]#

Delay variable which has a fixed delay length.

Parameters:
  • delay_target (int, sequence of int) – The initial delay data.

  • delay_len (int) – The maximum delay length.

  • initial_delay_data (Any) –

    The delay data. It can be a Python number, like float, int, boolean values. It can also be arrays. Or a callable function or instance of Connector. Note that initial_delay_data should be arranged as the following way:

    delay = 1             [ data
    delay = 2               data
    ...                     ....
    ...                     ....
    delay = delay_len-1     data
    delay = delay_len       data ]
    

    Changed in version 2.2.3.2: The data in the previous version of LengthDelay is:

    delay = delay_len     [ data
    delay = delay_len-1     data
    ...                     ....
    ...                     ....
    delay = 2               data
    delay = 1               data ]
    

name: str

The delay object name.

batch_axis: int

The batch axis. If not provided, it will be inferred from the delay_target.

update_method: str

The method used for updating delay.

See also

TimeDelay

__init__(delay_target, delay_len, initial_delay_data=None, name=None, batch_axis=None, update_method='rotation')[source]#

Methods

__init__(delay_target, delay_len[, ...])

cpu()

Move all variable into the CPU device.

cuda()

Move all variables into the GPU device.

load_state_dict(state_dict[, warn, compatible])

Copy parameters and buffers from state_dict into this module and its descendants.

load_states(filename[, verbose])

Load the model states.

nodes([method, level, include_self])

Collect all children nodes.

register_implicit_nodes(*nodes[, node_cls])

register_implicit_vars(*variables[, var_cls])

reset(delay_target[, delay_len, ...])

retrieve(delay_len, *indices)

Retrieve the delay data acoording to the delay length.

save_states(filename[, variables])

Save the model states.

state_dict()

Returns a dictionary containing a whole state of the module.

to(device)

Moves all variables into the given device.

tpu()

Move all variables into the TPU device.

train_vars([method, level, include_self])

The shortcut for retrieving all trainable variables.

tree_flatten()

Flattens the object as a PyTree.

tree_unflatten(aux, dynamic_values)

Unflatten the data to construct an object of this class.

unique_name([name, type_])

Get the unique name for this object.

update(value)

Update delay variable with the new data.

vars([method, level, include_self, ...])

Collect all variables in this node and the children nodes.

Attributes

delay_shape

The data shape of this delay variable.

delay_target_shape

The data shape of the delay target.

name

Name of the model.