Solved by henrychacon in post #10 
              
              
                Hi @justusschock and @ptrblck: Thanks for your help. I changed the optimizer function from Adam to SGD and the loss function is minimized.