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

Double post from here: [Solved][Pytorch1.5] RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation - #39 by ptrblck