Can't work with pytorch's gpu tensor

I am really new to ray,so my question below maybe stupid.Any help is appreciated


@ray.remote(num_gpus=1,)
class RLWORKER:
    def __init__(self,worker_idx) -> None:
        self.gpu_ids = ray.get_gpu_ids()
        os.environ["CUDA_VISIBLE_DEVICES"] = str(self.gpu_ids[0])
        # print(os.environ["CUDA_VISIBLE_DEVICES"])
        # print(self.gpu_ids,'fdshajkfhdskhfdsjk')
        device=torch.device(f'cuda:{self.gpu_ids[0]}')
        # print(device)
        self.x=torch.zeros(3,device=device)
        # self.x=torch.zeros(3)
        print(self.x)
        return


if __name__ == '__main__':
    ray.init(num_gpus=2)
    nworker=2
    s_RLWORKER=[RLWORKER.remote(worker_idx=i) for i in range(nworker)]
    s=ray.wait([worker.train.remote() for worker in s_RLWORKER])
    print(s)


and the return is “RuntimeError: CUDA error: invalid device ordinal”,why? I cant binding a actor to a certain device?