I get this error by a simple command like
torch.cuda.FloatTensor(1000, 1000).fill_(0)
But
torch.cuda.current_device()
torch.cuda.device(0)
torch.cuda.device_count()
torch.cuda.get_device_name(0)
torch.cuda.is_available()
works.