Skip to content
masterclass Buddy

PyTorch · Method

tensor.cuda

Moves a tensor to CUDA memory. It can select a GPU, request a memory format, and optionally perform an asynchronous host-side copy from pinned memory.

Last updated

Syntax

Tensor.cuda(device=None, non_blocking=False, memory_format=torch.preserve_format) → Tensor

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • torch.Tensor.is_cuda
  • torch.device
  • torch.memory_format
  • torch.preserve_format

Source: torch.Tensor.cuda — PyTorch 2.14 documentation. Checked 2026-11-03.