trace_cumulative¶
- trace_cumulative(observation: Tensor, trace: Tensor | None, *, decay: float, amplitude: int | float | complex, target: int | float | bool | complex, tolerance: int | float | None = None) Tensor[source]¶
Performs a trace for a time step, considering all prior matches.
\[x(t) = x(t - \Delta t) \alpha + A \left[\lvert h(t) - h^* \rvert \leq \epsilon\right]\]The event mask created will be cast to the datatype of
observationiftraceisNoneand to the datatype oftraceotherwise.- Parameters:
observation (torch.Tensor) – latest state to consider for the trace, \(h\).
trace (torch.Tensor | None) – current value of the trace, \(x\), if not the initial condition.
decay (float) – decay term of the trace, \(\alpha\), unitless.
amplitude (int | float | complex) – value to add to trace to for matching elements, \(A\).
target (int | float | bool | complex) – target value to set trace to, \(h^*\).
tolerance (int | float | None, optional) – allowable absolute difference to still count as a match, \(\epsilon\). Defaults to
None.
- Returns:
updated trace, incorporating the new observation.
- Return type:
Important
To compute a regular, exponentially decaying trace, this assumes that
decayis precomputed as \(\exp\left(-\frac{\Delta t}{\tau}\right)\) or as \(\exp\left(-\lambda\Delta t\right)\), where \(\Delta t\) is the simulation step time and \(\tau\) is the decay time constant and \(\lambda\) is the decay rate constant.