CUDA Device Assert Trigger when moving tensor from CPU to GPU


I tried to move a tensor from cpu to gpu by doing:

>>> t = torch.tensor(1)
>>> t.cuda()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: CUDA error: device-side assert triggered

All cpu tensors can’t be moved to GPU. My pytorch cuda is 10.2, pytorch version 1.5.1. Nvidia-SMI info as follows:

NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0

Could someone help me out?

This error points to an installation (or unlikely a hardware) issue.
Did you restart your workstation after installing or upgrading some drivers?
If so, make sure you are able to run some CUDA samples.

Thanks for your reply. Reinstalling pytorch and cudatoolkit solved everything.