torch.cuda.caching_allocator_alloc — PyTorch 2.7 documentation (original) (raw)

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

Perform a memory allocation using the CUDA memory allocator.

Memory is allocated for a given device and a stream, this function is intended to be used for interoperability with other frameworks. Allocated memory is released throughcaching_allocator_delete().

Parameters