mlx.core.asarray

Contents

mlx.core.asarray#

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

Convert the input to an array.

Parameters:
  • a – Input data.

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

  • copy (bool, optional) – Must be True or unspecified. False is not supported, since MLX has no in-place operations and cannot return a non-copying view.

Returns:

An array interpretation of the input.

Return type:

array

Raises:

ValueError – If copy is False.