cupy.from_dlpack#
- cupy.from_dlpack(array)#
Zero-copy conversion between array objects compliant with the DLPack data exchange protocol.
- Parameters
array (object) – an array object that implements two methods:
__dlpack__()
and__dlpack_device__()
.- Returns
a CuPy array that can be safely accessed on CuPy’s current stream.
- Return type
Note
This function is different from CuPy’s legacy
fromDlpack()
function. This function takes any object implementing the DLPack data exchange protocol, as well as a rawPyCapsule
object that contains the DLPack tensor as input (for backward compatibility), whereasfromDlpack()
only acceptsPyCapsule
objects. If the input object is not compliant with the protocol, users are responsible to ensure data safety.See also