MCPcopy Create free account
hub / github.com/LMCache/LMCache / _CudaArrayWrapper

Class _CudaArrayWrapper

lmcache/python_ops_fallback.py:185–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183 typestr = "<i2" if is_bf16 else _DTYPE_TO_TYPESTR.get(dtype, "|u1")
184
185 class _CudaArrayWrapper:
186 def __init__(self, ptr_int: int, shape_tuple: tuple, type_str: str):
187 self.__cuda_array_interface__ = {
188 "data": (ptr_int, False),
189 "shape": shape_tuple,
190 "typestr": type_str,
191 "version": 3,
192 }
193
194 t = torch.as_tensor(_CudaArrayWrapper(ptr, (numel,), typestr), device=device)
195 if is_bf16:

Callers 1

_tensor_from_cuda_ptrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected