Thanks Roy. I did what you suggested. Below is the output of nvidia-smi:
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1324      G   /usr/lib/xorg/Xorg                            37MiB |
|    0      1419      G   /usr/bin/gnome-shell                          50MiB |
|    0      1725      G   /usr/lib/xorg/Xorg                           338MiB |
|    0      1893      G   /usr/bin/gnome-shell                         190MiB |
|    0      1905      G   /opt/teamviewer/tv_bin/TeamViewer             21MiB |
|    0      2285      G   ...-token=E170E820957801A9C1BEAF1C38D248C6    45MiB |
|    0      2630      G   ...-token=66DB471AF199475291E8749402E957B5   153MiB |
|    0     21478      C   ...n/.virtualenvs/torch_gpu_0.4/bin/python   549MiB |
|    1      6413      C   ...n/.virtualenvs/torch_gpu_0.4/bin/python   703MiB |
|    1     21041      C   ...n/.virtualenvs/torch_gpu_0.4/bin/python   703MiB |
+-----------------------------------------------------------------------------+

The process with PID 21478 is the one that was created as a result of a = torch.tensor([], device=‘cuda:0’). That is a lot of memory for an empty tensor!!