mars.tensor.array(x, dtype=None, copy=True, ndmin=None, chunk_size=None)[source]

Create a tensor.

object : array_like
An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence.
dtype : data-type, optional
The desired data-type for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence. This argument can only be used to ‘upcast’ the array. For downcasting, use the .astype(t) method.
copy : bool, optional
If true (default), then the object is copied. Otherwise, a copy will only be made if __array__ returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy any of the other requirements (dtype, order, etc.).
ndmin : int, optional
Specifies the minimum number of dimensions that the resulting array should have. Ones will be pre-pended to the shape as needed to meet this requirement.
chunk_size: int, tuple, optional
Specifies chunk size for each dimension.
out : Tensor
An tensor object satisfying the specified requirements.

empty, empty_like, zeros, zeros_like, ones, ones_like, full, full_like

>>> import mars.tensor as mt
>>> mt.array([1, 2, 3]).execute()
array([1, 2, 3])


>>> mt.array([1, 2, 3.0]).execute()
array([ 1.,  2.,  3.])

More than one dimension:

>>> mt.array([[1, 2], [3, 4]]).execute()
array([[1, 2],
       [3, 4]])

Minimum dimensions 2:

>>> mt.array([1, 2, 3], ndmin=2).execute()
array([[1, 2, 3]])

Type provided:

>>> mt.array([1, 2, 3], dtype=complex).execute()
array([ 1.+0.j,  2.+0.j,  3.+0.j])