mlx.core.asarray

目錄

mlx.core.asarray#

asarray(a: scalar | array | Sequence | DLPackCompatible, dtype: Dtype | None = None, *, copy: bool | None = None) → array#

Convert the input to an array.

參數:
  • a -- Input data.

  • dtype (Dtype, optional) -- The desired data-type for the array.

  • 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 DLPack imports preserve the DLPack strides.

回傳值:

An array interpretation of the input.

回傳值型別:

array

引發:

ValueError -- If copy is False and a copy is required.