MCPcopy Create free account
hub / github.com/apache/arrow / __dlpack_device__

Method __dlpack_device__

python/pyarrow/interchange/buffer.py:85–94  ·  view source on GitHub ↗

Device type and device ID for where the data in the buffer resides. Uses device type codes matching DLPack. Note: must be implemented even if ``__dlpack__`` is not.

(self)

Source from the content-addressed store, hash-verified

83 raise NotImplementedError("__dlpack__")
84
85 def __dlpack_device__(self) -> tuple[DlpackDeviceType, int | None]:
86 """
87 Device type and device ID for where the data in the buffer resides.
88 Uses device type codes matching DLPack.
89 Note: must be implemented even if ``__dlpack__`` is not.
90 """
91 if self._x.is_cpu:
92 return (DlpackDeviceType.CPU, None)
93 else:
94 raise NotImplementedError("__dlpack_device__")
95
96 def __repr__(self) -> str:
97 return (

Callers 5

__repr__Method · 0.95
check_dlpack_exportFunction · 0.80
test_non_cpu_arrayFunction · 0.80
test_bufferFunction · 0.80

Calls

no outgoing calls

Tested by 4

check_dlpack_exportFunction · 0.64
test_non_cpu_arrayFunction · 0.64
test_bufferFunction · 0.64