@songying
2020-02-18T12:52:42.000000Z
字数 224
阅读 1408
pytorch
export CUDA_VISIBLE_DEVICES=1,2,3
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import torch
torch.cuda.set_device(id)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")