RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 6890]], which is output 0 of SelectBackward, is at version 1; expected version 0 instead. Hint: enable anomaly detect

Hi July!

Can you identify a tensor in your forward pass that has shape [1, 6890]?
See if you can find where it is being modified.

Try using set_detect_anomaly (True). Doing so provides additional
information that can be very helpful in tracking down the cause of your
error.

There’s a lot of code that you haven’t posted that could be causing your
error.

You’ve posted two nearly identical versions of get_pose() (and we can’t
tell which one is being run when you get your error).

Note, this second version uses pose.data. .data is deprecated (in the
public api) and can lead to errors, so you shouldn’t be using it.

For suggestions about how to find and fix inplace-modification errors,
please see the following post:

Good luck!

K. Frank