Solved by user_123454321 in post #2 
              
              
                I believe it is because nn.ConvTranspose2d is not defined in __init__. Any reason why it is not defined there but defined when forward is called?