torch.optim.StateDictPreHook export type StateDictPreHook = (optimizer: Optimizer) => void; Hook that runs before state_dict is called.