Tensor Creation Routines#

Basic creation routines#

mars.tensor.empty

Return a new tensor of given shape and type, without initializing entries.

mars.tensor.empty_like

Return a new tensor with the same shape and type as a given tensor.

mars.tensor.eye

Return a 2-D tensor with ones on the diagonal and zeros elsewhere.

mars.tensor.identity

Return the identity tensor.

mars.tensor.ones

Return a new tensor of given shape and type, filled with ones.

mars.tensor.ones_like

Return a tensor of ones with the same shape and type as a given tensor.

mars.tensor.zeros

Return a new tensor of given shape and type, filled with zeros.

mars.tensor.zeros_like

Return a tensor of zeros with the same shape and type as a given tensor.

mars.tensor.full

Return a new tensor of given shape and type, filled with fill_value.

Creation from other data#

mars.tensor.tensor

mars.tensor.array

Create a tensor.

mars.tensor.asarray

Convert the input to an array.

mars.tensor.ascontiguousarray

Return a contiguous tensor (ndim >= 1) in memory (C order).

Numerical ranges#

mars.tensor.arange

Return evenly spaced values within a given interval.

mars.tensor.linspace

Return evenly spaced numbers over a specified interval.

mars.tensor.meshgrid

Return coordinate matrices from coordinate vectors.

mars.tensor.mgrid

Construct a multi-dimensional "meshgrid".

mars.tensor.ogrid

Construct a multi-dimensional "meshgrid".

Building matrices#

mars.tensor.diag

Extract a diagonal or construct a diagonal tensor.

mars.tensor.diagflat

Create a two-dimensional tensor with the flattened input as a diagonal.

mars.tensor.tril

Lower triangle of a tensor.

mars.tensor.triu

Upper triangle of a tensor.

Misc#

mars.tensor.ExecutableTuple