Skip to content

clone_state_dict_tensors ​

python
clone_state_dict_tensors(state_dict: T) -> T

Deep-copy all tensors inside a (possibly nested) state dict.

Checkpoint files are written on a background thread while training continues, so the captured model and optimizer state dicts must not reference live parameter or optimizer tensors that the learner keeps mutating.

Parameters:

  • state_dict ([clone_state_dict_tensors[T]](#mrkwatkins.oakemu_rl.framework.checkpoints.StateDictSnapshot.clone_state_dict_tensors[T])) – A state dict, or any nested structure of dicts, lists, tuples, and tensors.

Returns:

  • [clone_state_dict_tensors[T]](#mrkwatkins.oakemu_rl.framework.checkpoints.StateDictSnapshot.clone_state_dict_tensors[T]) – A structure of the same shape with every tensor cloned.

Source