mlx.core.from_dlpack

目录

mlx.core.from_dlpack#

from_dlpack(x: DLPackCompatible, /, *, copy: bool | None = None) → array#

Create an array from an object that supports DLPack.

参数:
  • x -- Input object implementing __dlpack__ and __dlpack_device__.

  • copy (bool, optional) -- Whether to copy the input. If True, always copy. If False, never copy. If None, share memory when possible and copy otherwise. Zero-copy imports preserve the DLPack strides.

返回:

An array containing the input data.

返回类型:

array