Ho, the answer is that because of how pytorch works, a gradient of 0 can be represented in 3 ways:

A Tensor full of 0s
None being returned by autograd.grad(…, allow_unused=True) or the in the .grad field after .backward()
An error with autograd.grad(…, allow_unused=False)

Note that we have no way to differentiate “is independent of” and “has a gradient of 0” and both can be represented in the three ways above.