.state()
Return the full optimizer state, including hyperparameters and velocities.
The returned dict contains enough information to resume training from an exact checkpoint.
Velocities are nested inside each group entry so the structure mirrors param_groups.
Returns:
-
dict–Dict with
step_countand aparam_groupslist. -
dict–Each group entry contains its
label, hyperparameters (lr,momentum,dampening), -
dict–and a
velocitiesdict mapping parameter names to their current velocity arrays.