You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I use the code for the case where I have a custom loss function, and not a torch.nn."LOSS"?
I'm specifically trying to reproduce the results in https://arxiv.org/abs/2109.01050 , and cannot get the PyHessian class to work.
Also, in the PINN case, network does not have a data=(inputs, targets), can I use the same code/class or I need further edits?
How can I use the code for the case where I have a custom loss function, and not a torch.nn."LOSS"?
I'm specifically trying to reproduce the results in https://arxiv.org/abs/2109.01050 , and cannot get the PyHessian class to work.
Also, in the PINN case, network does not have a data=(inputs, targets), can I use the same code/class or I need further edits?
I'm thinking of changing the loss in line 92
PyHessian/pyhessian/hessian.py
Line 92 in 1a42737
with my custom loss (from the network)
wondering if that's all the changes I need
PS:
Also since I'm only interested in the eigenvectors, tried to exctract parameters and gradients, i.e.,
PyHessian/pyhessian/utils.py
Line 61 in 1a42737
and pass it to
PyHessian/pyhessian/hessian.py
Line 111 in 1a42737
Though it's throwing some error at me, would appreciate any insights,
`Traceback (most recent call last):
File "/tmp/ipykernel_709492/339026100.py", line 1, in
hv = torch.autograd.grad(gradsH,
File "/home/xxx/.local/lib/python3.8/site-packages/torch/autograd/init.py", line 229, in grad
grad_outputs_ = make_grads(outputs, grad_outputs)
File "/home/xxx/.local/lib/python3.8/site-packages/torch/autograd/init.py", line 33, in _make_grads
if not out.shape == grad.shape:
AttributeError: 'float' object has no attribute 'shape'`
The text was updated successfully, but these errors were encountered: