Resets gradients of all model parameters. See similar function under torch.optim.Optimizer for more context.
torch.optim.Optimizer
set_to_none (bool) – instead of setting to zero, set the grads to None. See torch.optim.Optimizer.zero_grad() for details.
torch.optim.Optimizer.zero_grad()