MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / from_cuda

Method from_cuda

samples/interoperability/cuda_python_common.py:48–58  ·  view source on GitHub ↗

Create from __cuda_array_interface__ or object that implements it.

(cuda_obj)

Source from the content-addressed store, hash-verified

46
47 @staticmethod
48 def from_cuda(cuda_obj) -> "CudaBuffer":
49 """Create from __cuda_array_interface__ or object that implements it."""
50 if hasattr(cuda_obj, "__cuda_array_interface__"):
51 cuda_array_interface = cuda_obj.__cuda_array_interface__
52 else:
53 cuda_array_interface = cuda_obj
54 return CudaBuffer(
55 shape=cuda_array_interface["shape"],
56 dtype=np.dtype(cuda_array_interface["typestr"]),
57 ptr=cuda_array_interface["data"][0],
58 )
59
60 @property
61 def __cuda_array_interface__(self):

Callers 1

mainFunction · 0.80

Calls 2

CudaBufferClass · 0.70
dtypeMethod · 0.45

Tested by

no test coverage detected