amirgholami / PyHessian

PyHessian is a Pytorch library for second-order based analysis and training of Neural Networks
MIT License
694 stars 119 forks source link

RuntimeError: derivative for grid_sampler_2d_backward is not implemented #7

Closed krishnateja95 closed 4 years ago

krishnateja95 commented 4 years ago

Thanks for making PyHessian public. I am trying to find Eigenvalues for a Neural Net that I'm implementing. I set require_grad = True for the weight variables for which I want to calculate the Eigenvalues. I am getting the following error:

RuntimeError: derivative for grid_sampler_2d_backward is not implemented

I was able to calculate first order gradients easily. I am unable to calculate Hv which is at:

hv = torch.autograd.grad(gradsH, params, grad_outputs=v, only_inputs=True, retain_graph=True)

Could you let me know what the problem could be ?

yaozhewei commented 4 years ago

It seems your module grid_sampler_2d_backward does not support second-order backprop.