Rate this Page

torch.cuda.memory.caching_allocator_alloc#

torch.cuda.memory.caching_allocator_alloc(size,device=None,stream=None)[source]#

Perform a memory allocation using the CUDA memory allocator.

Memory is allocated for a given device and a stream, thisfunction is intended to be used for interoperability with otherframeworks. Allocated memory is released throughcaching_allocator_delete().

Parameters
  • size (int) – number of bytes to be allocated.

  • device (torch.device orint,optional) – selected device. If it isNone the default CUDA device is used.

  • stream (torch.cuda.Stream orint,optional) – selected stream. If isNone thenthe default stream for the selected device is used.

Note

SeeMemory management for more details about GPU memorymanagement.