Strange error: one of the variables needed for gradient computation has been modified by an inplace operation

You would have to check if the manipulated tensor is needed in its original form for the gradient calculation, which disallows inplace operations on it.
This post shows you a simple example.

1 Like