I am working with an autoencoder model which takes an input image and reconstructs it for the output. I am using MSELoss here. I want to perform certain transformations on the model output (matrix multiplication with some other matrix, addition, then matrix multiplication again) before computing the loss on it. I tried implementing this but got the error:
one of the variables needed for gradient computation has been modified by an inplace operation.
Is there a workaround to perform these operations on the output?