jax.numpy.asarrayΒΆ

jax.numpy.asarray(a, dtype=None, order=None)[source]ΒΆ

Convert the input to an array.

LAX-backend implementation of asarray().

This function will create arrays on JAX’s default device. For control of the device placement of data, see jax.device_put(). More information is available in the JAX FAQ at Controlling data and computation placement on devices (full FAQ at https://jax.readthedocs.io/en/latest/faq.html).

Original docstring below.

Parameters
  • a (array_like) – Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays.

  • dtype (data-type, optional) – By default, the data-type is inferred from the input data.

  • order ({'C', 'F', 'A', 'K'}, optional) – Memory layout. β€˜A’ and β€˜K’ depend on the order of input array a. β€˜C’ row-major (C-style), β€˜F’ column-major (Fortran-style) memory representation. β€˜A’ (any) means β€˜F’ if a is Fortran contiguous, β€˜C’ otherwise β€˜K’ (keep) preserve input order Defaults to β€˜K’.

Returns

out – Array interpretation of a. No copy is performed if the input is already an ndarray with matching dtype and order. If a is a subclass of ndarray, a base class ndarray is returned.

Return type

ndarray