OTTT#

class braintrace.OTTT(model, mode='A', leak=None, name=None, vjp_method='single-step', **kwargs)#

Online Training Through Time.

Parameters:
  • model (Module)

  • mode (str) – ‘A’ (default) accumulates â over time (â ← λ·â + x). ‘O’ uses the instantaneous presynaptic spike only (â := x_t).

  • leak (float | None) – Presynaptic leak λ. If None, discovered from the model via _resolve_leak.

  • name (str | None)

  • vjp_method (str)

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

Initialize the eligibility trace states of the etrace algorithm.

This method is needed after compiling the etrace graph. See .compile_graph() for the details.

Parameters:
  • *args – The positional arguments.

  • **kwargs – The keyword arguments.

Raises:

NotImplementedError – This method must be implemented by subclasses.

reset_state(batch_size=None, **kwargs)[source]#

State resetting function.