PrefetchDelay

PrefetchDelay#

class brainstate.nn.PrefetchDelay(module, item)[source]#

Provides access to delayed versions of a prefetched state or variable.

This class acts as an intermediary for accessing delayed values of module variables. It doesn’t retrieve values directly but provides methods to specify the delay time via the at() method.

Parameters:
  • module (Dynamics) – The dynamics module that contains the referenced state or variable.

  • item (str) – The name of the state or variable to access with delay.

Examples

>>> import brainstate
>>> import brainunit as u
>>> neuron = brainpy.state.LIF(10)
>>> # Access voltage delayed by 5ms
>>> delayed_v = neuron.prefetch('V').delay.at(5.0 * u.ms)
>>> delayed_value = delayed_v()  # Get the delayed value
at(*delay_time)[source]#

Specifies the delay time for accessing the variable.

Parameters:

time (ArrayLike) – The amount of time to delay the variable access, typically in time units (e.g., milliseconds).

Returns:

An object that provides access to the variable at the specified delay time.

Return type:

PrefetchDelayAt