I want to use gradient clipping
torch.nn.utils.clip_grad_norm(loss, model.parameters()

I’m getting the error stack expects a non-empty Tensor List. I read in the forums, @tom highlighted that gradients need to be computed first (loss.backward()) before calling clip_grad_norm_ (not much info in the documentation). I’m updating the model’s parameter in a bit different manner.
grad = torch.autograd.grad(loss, model.parameters())

And then doing the updating manually.
How can gradient clipping be used in this case ?