Right, that was my guess and it points to a detached computation graph.
This might be the case if you’ve used e.g. non-differentiable functions, called tensor.detach(), tensor.item(), used another library for some operations such as numpy, or re-wrapped a tensor via x = torch.tensor(x). Could you check for these operations?
If you cannot find any of these ops, could you post your model definition so that we could debug it?