Solved by ptrblck in post #2 
              
              
                Modules don’t have a grad definition, but parameters or tensors. 
You can find the attribute/property definition here. tensor.grad will be populated e.g. after a backward operation or torch.autograd.grad call and will give you the gradient of X w.r.t. this tensor.