I am trying to compute a loss on the jacobian of the network (i.e. to perform double backprop), and I get the following error: RuntimeError: one of the variables needed for
You can make use of set_detect_anomaly function available in autograd package to exactly find which line is responsible for the error.
set_detect_anomaly
autograd
Here is the link which describes the same problem and a solution using the abovementioned function.