SwinTransformer / Video-Swin-Transformer

This is an official implementation for "Video Swin Transformers".
https://arxiv.org/abs/2106.13230
Apache License 2.0
1.42k stars 199 forks source link

RuntimeError : one of the variables needed for gradient computation has been modified by an inplace operation: #62

Closed zhanggj821 closed 2 years ago

zhanggj821 commented 2 years ago

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.LongTensor [9604]] is at version 5; expected version 4 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient.

I use torch.autograd.set_detect_anomaly(True) to detect the error, and the result show that there maybe some error (inplace operation) in WindowsAttention3D's forward function specifically self.relative_position_index or anywhere later. My torch version is 1.6