Solved by richard in post #2 
              
              
                You can check with print(x.requires_grad) 
You can set it with x.requires_grad_(true): https://pytorch.org/docs/master/tensors.html?highlight=requires_grad#torch.Tensor.requires_grad_