I faced to something weird error when I try to move Tensor to GPU.
First my machine spec is
Ubuntu 16.04
nvidia driver: 390.77
GPU: TitanX (Pascal)

Torch 0.4.1 (with cuda9.0)
I didn’t install any cuda Toolkit in my local, just download pytorch via anaconda to my virtualenv. (because I saw some posts that downloading pytorch via anaconda will install automatically cuda and what I need to do is just install proper nvidia driver in my machine)
After install pytorch and run some simple code
import torch
a = torch.rand(5, 3)
device = torch.device(‘cuda’)
a.to(device)
Then I encountered above error. (I also checked torch.cuda.is_available() and that returned True)
But when I run the python in sudo permission (like  sudo ./~~/env/bin/python3) Then the above simple code perfectly worked. <some posts said that the cuda initialization once in sudo then normal user permission can run  cuda normaly but in my case, it didn’t work. Every time I need to run python as sudo to make perform above code>
Please help.