Not all tensors are observable through python. So your code doesn’t print the actual GPU memory usage.
If you can build from source, try building from this PR: https://github.com/pytorch/pytorch/pull/4511 47. It can give the actual GPU usage.