What I’d like to do is
import os, torch

print(torch.cuda.is_available())  # True

os.environ["CUDA_VISIBLE_DEVICES"]="-1"
print(torch.cuda.is_available())  # False

os.environ["CUDA_VISIBLE_DEVICES"]=""
print(torch.cuda.is_available())  # True

But os.environ["CUDA_VISIBLE_DEVICES"]="" does not make cuda available again. How can I do that?