with [torch.no_grad](https://docs.pytorch.org/docs/stable/generated/torch.no_grad.html#torch.no_grad "torch.no_grad")(): [weights](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") -= [weights.grad](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") * lr [bias](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") -= [bias.grad](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") * lr [weights.grad](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").zero_() [bias.grad](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").zero_()