aitune.torch.libs.cuda.memory
CUDA memory utilities for GPU-to-GPU transfers.
Module Contents
Functions
Data
API
Copy a CUDA device buffer into a new torch tensor via D2D memcpy (no CPU round-trip).
Parameters:
ptr
Raw CUDA pointer to the source buffer (e.g. OrtValue.data_ptr()).
shape
Shape of the buffer.
ort_dtype
ORT data type string (e.g. "tensor(float)").
device
Target CUDA device for the output tensor.
Returns: torch.Tensor
A new CUDA torch tensor containing a copy of the source buffer.
Raises:
KeyError: Ifort_dtypeis not a recognised ORT type string.RuntimeError: If the CUDA memcpy fails.