Indexing Routines#

Generating index arrays#

mars.tensor.c_

Translates slice objects to concatenation along the second axis.

mars.tensor.r_

Translates slice objects to concatenation along the first axis.

mars.tensor.nonzero

Return the indices of the elements that are non-zero.

mars.tensor.where

Return elements, either from x or y, depending on condition.

mars.tensor.indices

Return a tensor representing the indices of a grid.

mars.tensor.ogrid

Construct a multi-dimensional "meshgrid".

mars.tensor.unravel_index

Converts a flat index or tensor of flat indices into a tuple of coordinate tensors.

Indexing-like operations#

mars.tensor.take

Take elements from a tensor along an axis.

mars.tensor.choose

Construct a tensor from an index tensor and a set of tensors to choose from.

mars.tensor.compress

Return selected slices of a tensor along given axis.

mars.tensor.diag

Extract a diagonal or construct a diagonal tensor.