southernKid33
southernKid33

Reputation: 351

Set Pytorch to run on AMD GPU

According to the official docs, now PyTorch supports AMD GPUs. ROCm 4.2 can be installed through pip. But I can not find in Google nor the official docs how to force my DL training to use the GPU. What is the AMD equivalent to the following command?

torch.device('cuda' if torch.cuda.is_available() else 'cpu')

Upvotes: 4

Views: 3677

Answers (1)

JustOneMan
JustOneMan

Reputation: 202

ROCm translates CUDA codes. So torch.cuda.is_available() should work.

Upvotes: 1

Related Questions