dpnp.ndarray.__dlpack__

method

ndarray.__dlpack__(*, stream=None, max_version=None, dl_device=None, copy=None)

Produces DLPack capsule.

Parameters:
  • stream ({dpctl.SyclQueue, None}, optional) --

    Execution queue to synchronize with. If None, synchronization is not performed.

    Default: None.

  • ints (max_version {tuple of) --

    The maximum DLPack version the consumer (caller of __dlpack__) supports. As __dlpack__ may not always return a DLPack capsule with version max_version, the consumer must verify the version even if this argument is passed.

    Default: None.

  • None} --

    The maximum DLPack version the consumer (caller of __dlpack__) supports. As __dlpack__ may not always return a DLPack capsule with version max_version, the consumer must verify the version even if this argument is passed.

    Default: None.

  • optional --

    The maximum DLPack version the consumer (caller of __dlpack__) supports. As __dlpack__ may not always return a DLPack capsule with version max_version, the consumer must verify the version even if this argument is passed.

    Default: None.

  • {tuple (dl_device) --

    The device the returned DLPack capsule will be placed on. The device must be a 2-tuple matching the format of __dlpack_device__ method, an integer enumerator representing the device type followed by an integer representing the index of the device.

    Default: None.

  • None} --

    The device the returned DLPack capsule will be placed on. The device must be a 2-tuple matching the format of __dlpack_device__ method, an integer enumerator representing the device type followed by an integer representing the index of the device.

    Default: None.

  • optional --

    The device the returned DLPack capsule will be placed on. The device must be a 2-tuple matching the format of __dlpack_device__ method, an integer enumerator representing the device type followed by an integer representing the index of the device.

    Default: None.

  • {bool (copy) --

    Boolean indicating whether or not to copy the input.

    • If copy is True, the input will always be copied.

    • If False, a BufferError will be raised if a copy is deemed necessary.

    • If None, a copy will be made only if deemed necessary, otherwise, the existing memory buffer will be reused.

    Default: None.

  • None} --

    Boolean indicating whether or not to copy the input.

    • If copy is True, the input will always be copied.

    • If False, a BufferError will be raised if a copy is deemed necessary.

    • If None, a copy will be made only if deemed necessary, otherwise, the existing memory buffer will be reused.

    Default: None.

  • optional --

    Boolean indicating whether or not to copy the input.

    • If copy is True, the input will always be copied.

    • If False, a BufferError will be raised if a copy is deemed necessary.

    • If None, a copy will be made only if deemed necessary, otherwise, the existing memory buffer will be reused.

    Default: None.

Raises:
  • MemoryError: -- when host memory can not be allocated.

  • DLPackCreationError: -- when array is allocated on a partitioned SYCL device, or with a non-default context.

  • BufferError: -- when a copy is deemed necessary but copy is False or when the provided dl_device cannot be handled.