core.resharding.nvshmem_copy_service.memory.tensor_pointer_utils#
Utilities for extracting data pointers from different tensor types.
Supports PyTorch tensors, CuPy arrays, and raw integer pointers.
Module Contents#
Classes#
Extract memory pointers from various tensor types. |
API#
- class core.resharding.nvshmem_copy_service.memory.tensor_pointer_utils.TensorPointerExtractor#
Extract memory pointers from various tensor types.
- static get_pointer(tensor: Any) int#
Extract the data pointer from a tensor.
- Parameters:
tensor – Can be torch.Tensor, CuPy array, or raw int pointer
- Returns:
Memory address of the tensor data
- Return type:
int
.. rubric:: Examples
import torch
t = torch.zeros(100, device=’cuda’)
ptr = TensorPointerExtractor.get_pointer(t)
isinstance(ptr, int)
True