optimizer.step() is a method defined in torch.optim.Optimizer, which is a base class for all optimizers. You should ‘call’ it for your parameters to be updated. Check this torch.optim — PyTorch 1.8.1 documentation 2.