On empty jupyter notebook
Current memory use 2.6GiB of 7.7 GiB as seen on Ubuntu System Monitor

a = torch.tensor(1).cuda(0)

After running the command above memory use jumps to 4.7GiB

I’m not able to release this memory other than restarting the kernel. Tried del a, working on cuda in a function and torch.cuda.empty_cuda() but these do not work.
This only happens the first time I send tensor to cuda. To me this use of memory is ironic as I’m working on GPU and it limits how much I can send to cuda as the RAM committed does grow when batch sizes grow.
Working with tensor on .cpu() has none of these memory commitment issues.
My questions are:

Why is so much memory being committed when sending tensor with single INT tensor to GPU?
How can I release this memory again without killing the kernel?