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())
Thanks for replying but I’m still not sure clip norm in this case. Inside the function, we don’t calculate grads, so do I compute that and then make modifications. I see that this clipping operation is applied on params, what changes do I make if I want an equivalent operation on grads then. And is this all really needed ? The only difference in how I update the model params.