Inplace operation error for gradient computation when trained on two dataloaders

Hi Jiawei!

First, look in your code for tensors of shape [2048] that may be the tensor
that is being modified. Then for any plausible candidate tensor, t, print out
t._version at various place in your code to see if that tensor’s ._version
changes from 2 to 3. You can then use a binary-search strategy by printing
out t._version at additional places in your code to determine the specific
operation that is modifying t inplace.

If it turns out that t._version increases from 2 to 3 when you call into some
third-party code, continue your binary search adding print statements to the
third-party code you are calling into.

Once you’ve found the source of the inplace modification, the fix for the error
is sometimes relatively clear.

Further discussion of how to debug inplace-modification errors can be found
in the following post:

Good luck!

K. Frank