bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / from_dlpack
built-in
numpy:from_dlpack
Signature
from_dlpack ( x , / , device = None , copy = None ) Summary
Create a NumPy array from an object implementing the __dlpack__ protocol. Generally, the returned NumPy array is a view of the input object. See [1] and [2] for more details.
Parameters
x: objectA Python object that implements the
__dlpack__and__dlpack_device__methods.device: device, optionalDevice on which to place the created array. Default:
None. Must be"cpu"if passed which may allow importing an array that is not already CPU available.copy: bool, optionalBoolean indicating whether or not to copy the input. If
True, the copy will be made. IfFalse, the function will never copy, and will raiseBufferErrorin case a copy is deemed necessary. Passing it requests a copy from the exporter who may or may not implement the capability. IfNone, the function will reuse the existing memory buffer if possible and copy otherwise. Default:None.
Returns
out: ndarray
Aliases
-
numpy.from_dlpack