Solved by ptrblck in post #2 
              
              
                Create a separate optimizer by passing ae.enc.parameters() to it and use this new optimizer to update the encoder parameters only in opt_enc.step().