It looks like your model returns a tuple of both the output and the original input instead of just the output. You might need to manually unpack the output (e.g., do output[0]) before passing it to the loss function.