Solved by jpeg729 in post #4 
              
              
                w will be updated in the training process. 
The fact that w is an attribute of self to which a Parameter(...) is assigned tells PyTorch that it is a trainable parameter.