The memory might still be in the cache and thus not released. You could run torch.cuda.empty_cache() to get it back. I’m not 100% sure, but don’t think you need to release it in the C++ backend, since you are holding a reference to it in Python.