Seed snapshot
neps.state.seed_snapshot
#
Snapshot of the global rng state.
SeedSnapshot
dataclass
#
SeedSnapshot(
np_rng: NP_RNG_STATE,
py_rng: PY_RNG_STATE,
torch_rng: TORCH_RNG_STATE | None,
torch_cuda_rng: TORCH_CUDA_RNG_STATE | None,
)
State of the global rng.
Primarly enables storing of the rng state to disk using a binary format native to each library, allowing for potential version mistmatches between processes loading the state, as long as they can read the binary format.
new_capture
classmethod
#
new_capture() -> SeedSnapshot
Current state of the global rng.
Takes a snapshot, including cloning or copying any arrays, tensors, etc.
Source code in neps/state/seed_snapshot.py
recapture
#
Reread the state of the global rng into this snapshot.
Source code in neps/state/seed_snapshot.py
set_as_global_seed_state
#
Set the global rng to the given state.