pytorch 指定GPU訓練

指定GPU代碼 上述使用中,代碼3最爲常用,keras也可以通過這種方式來調用GPU訓練神經網絡。 # 代碼1: torch.cuda.set_device(1) # 代碼2: device = torch.device("cuda:1") # 代碼3:(官方推薦使用) os.environ["CUDA_VISIBLE_DEVICES"] = '1' (如果你想同時調用兩塊GPU的話) os
相關文章
相關標籤/搜索