Modules don’t have a grad definition, but parameters or tensors.
You can find the attribute/property definition here 2. 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.