torch.optim.Optimizer.step¶
- Optimizer.step(closure: None = None) None [source]¶
- Optimizer.step(closure: Callable[[], float]) float
Performs a single optimization step (parameter update).
- Parameters
closure (Callable) – A closure that reevaluates the model and returns the loss. Optional for most optimizers.
Note
Unless otherwise specified, this function should not modify the
.grad
field of the parameters.