Thank you for your reply, that is also what I suspected.
What still puzzles me is that the total capacity is 2 GiB but  only 1.06 GiB is allocated and I get the error. Where is the remaining memory?
From windows task manager it appears that GPU memory is full but from torch.cuda.memory_allocated(0) command I see that half of memory is free.