I think you’re not assigning your cuda device properly. Cuda device is usually assigned like this:
cuda:<device number> (usually, it’s 0). You can get the device number by running this command:
torch.cuda.current_device()