Solved by sio277 in post #2 
              
              
                Wrap your weight with nn.Parameter. After that, the tensor is registered as one of model parameters. Otherwise, it is not visible to model.parameters(), which are optimizer tries to update.