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 . The notations cuda:0 and cuda are equivalent and both refer to the first GPU.
0
1
Updated 2026-05-18
Tags
D2L
Dive into Deep Learning @ D2L