You can check it by accessing torch.Tensor's requires_grad attribute, which returns True if gradient should be calculated on that Tensor. Note that it has a contagious behavior, that is, if A.requires_grad=True for some Tensor A, all Tensors computed from A have the requires_grad attribute True.