ETraceVmap#
- class braintrace.ETraceVmap#
Provide sequence drivers on a
brainstate.nn.Vmapwrapper.Returned by
braintrace.compile(..., vmap=True)so the call site is identical in batched and unbatched mode. Because it is abrainstate.nn.Vmap, calling it, its attributes and everyisinstance(x, brainstate.nn.Vmap)check keep working; only the added methods are new.One thing does change:
type(x) is brainstate.nn.Vmapis nowFalse, so a caller dispatching on the exact runtime type takes a different branch, andreprreadsETraceVmap. Useisinstance. (Pickling is unaffected – a bareVmapwas already unpicklable, for the sameweakrefreason.)Reaching into
.moduleis not an equivalent:learner.module.etrace_grad(...)would drive the unbatched learner and silently produce per-lane-wrong results.Window mode is refused here – see
SequenceDriverMixin.etrace_grad().
- ETraceVmap.__init__(module, in_axes=0, out_axes=0, vmap_states=None, vmap_out_states=None, axis_name=None, axis_size=None)#