Solved by ptrblck in post #2 
              
              
                You can register parameters in your model with nn.Parameter. 
Alternatively, if you would like to train your parameter outside of a model, you could just use torch.randn(..., requires_grad=True). You can find an example here.