Hi I am runing a vision transformer variation and I get this error:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [64, 192, 16, 16]], which is output 0 of AsStridedBackward0, is at version 3; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
If you want to track down what is causing your issue, you can find some
techniques for debugging inplace-modification errors in this post:
Just speculation, but your FloatTensor [64, 192, 16, 16] could
be the .weight of a Conv2d (192. 64, 16) or maybe a batch of 64
192-channel 16 x 16 image patches.