Learn Before
Code
Indexing Multiple GPUs in PyTorch
When multiple GPUs are available in PyTorch, the GPU is represented using torch.device(f'cuda:{i}'), where the index starts at 0. The notations cuda:0 and cuda are equivalent and both refer to the first GPU.
0
1
Updated 2026-07-03
Tags
D2L
Dive into Deep Learning @ D2L