I’m no expert, but a leaf node is a Tensor that you explicitly created not as a result of some operation, so like torch.tensor([1.,2.]).
I don’t know what your variable displacement is, or what type of function it is used in, but is it created like torch.tensor(some_value, requires_grad=True)?