Solved by smth in post #2 
              
              
                First issue in your question: 
# WRONG!
(reconstLoss +outLoss.item()).backward()

# Correct
(reconstLoss +outLoss).backward()

x.item() returns it as a Python number, which means, your operations on the return of x.item() no longer come under the visibility of PyTorch. It’s pretty much like doing (r…