In a multi-GPU computer(Ubuntu 16),
I want to use GPU1 and do the following setting in the shell:
$ export CUDA_VISIBLE_DEVICES=1
$ python

But, I got an error when I set the device of the tensor:
Python 3.8.3 (default, May 19 2020, 18:47:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> a = torch.Tensor(1).to("cuda:0")
>>> a = torch.Tensor(1).to("cuda:1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: CUDA error: invalid device ordinal

Why I can’t specify the device of Tensor to GPU1 by to.