Code

Indexing Multiple GPUs in PyTorch

When multiple GPUs are available in PyTorch, the iextrmthi^{ extrm{th}} GPU is represented using torch.device(f'cuda:{i}'), where the index ii starts at 00. The notations cuda:0 and cuda are equivalent and both refer to the first GPU.

0

1

Updated 2026-05-18

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L