Expand description
Module checkpoints: capturing a module tree’s parameter payloads
and restoring them into a Parameters state.
Two identities, two tiers. The positional pair
(snapshot/restore) uses the module tree’s stable visit
order — sufficient for resuming the same code, with no names
anywhere. The named pair (named_snapshot/named_restore)
matches by structured Path, which is what survives code
evolution and what foreign checkpoints (name-to-tensor maps)
require; missing and unexpected paths are loud errors.
A checkpoint is pure state, so both directions are plain
Parameters transforms: no graph is touched, and shape
mismatches panic through
Parameters::with_payloads’s validation. The library stops at
the name-to-payload map; file formats stay at the edge.
Functions§
- named_
restore - Returns a new state with
module’s parameters replaced byentries, matched by path: the named restore. - named_
snapshot - Returns every parameter payload in
module’s tree with its structured path, in visit order: the named checkpoint, the form that survives code evolution and maps to foreign layouts. - restore
- Returns a new state with
module’s parameters replaced bypayloads, matched in visit order: the positional restore. Parameters outside the module keep their payloads. - snapshot
- Returns the payloads of every parameter in
module’s tree, in visit order: the positional checkpoint.