How to deal with this `torch.AcceleratorError: CUDA error: device-side assert triggered` error?
I am trying to compute the diagonal of the Fisher information matrix. I found this code that appears to do just that, but there are some issues with the code. First consider the code in its original form: estimated_fisher = {} for n, p in model.named_parameters(): estimated_fisher[n] = torch.zeros_like(p) model.eval() for i, (input, target) in enumerate(dl, 0): model.zero_grad() output = model(input.to(device)) label = target.to(device) loss = F.nll_loss(F.log_softmax(output, dim=1), label) loss.backward() # populate grad data # accumulate all the gradients for n, p in model.named_parameters()
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.