torch.optim.StepPreHook export type StepPreHook = (optimizer: Optimizer) => void; Hook that runs before the optimizer step.