TraceContextError

TraceContextError#

class brainstate.TraceContextError[source]#

Exception raised for trace-context violations.

This custom exception is used to signal that a State (or a related object) has been accessed outside of, or across an incompatible, JAX trace context. Such violations typically occur when a state created or captured in one trace is read or written from a different trace, breaking the referential transparency that JAX transformations (jit, grad, vmap, etc.) rely on.

Inherits from:

BrainStateError: The base error class for BrainState-related exceptions.