Solved by ptrblck in post #4 
              
              
                You are right and it shouldn’t make a difference, as the computation graph will be the same. 
It might be a typo or copy-paste issue, but your optimizer in the first approach takes the parameters from model, which is undefined. It should get the parameters of encoder and decoder so that it can upda…