loeweX/Greedy_InfoMax

Failure to compute gradient

rschwarz15 opened this issue · 2 comments

Hi,

I have found your paper and code extremely interesting!

I am trying to run the vision training, but am coming across an error:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [256, 256, 1, 1]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

When I do torch.autograd.set_detect_anomaly(True) the issue is traced to line 57 in InfoNCE_Loss:

ztwk = (
self.W_k[k - 1]
.forward(z[:, :, (k + skip_step) :, :]) # Bx, C , H , W

Any idea why this is hapenning?

Hi,

Thank you for your interest in our work!

I haven't encountered that error before, so I cannot give a definite answer. My guess would be that it could have something to do with the pytorch version that you are using. Did you make sure to use version 1.0.0?

Alternatively, have you tried following the advice in this article?

Right, I'd had a conflict error in the environment set up and had changed it to PyTorch 1.5