Tensor Indexing Routines#

Generating index arrays#

maxframe.tensor.c_

Translates slice objects to concatenation along the second axis.

maxframe.tensor.r_

Translates slice objects to concatenation along the first axis.

maxframe.tensor.nonzero

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

maxframe.tensor.where

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

maxframe.tensor.indices

Return a tensor representing the indices of a grid.

maxframe.tensor.ogrid

Construct a multi-dimensional "meshgrid".

maxframe.tensor.unravel_index

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

Indexing-like operations#

maxframe.tensor.take

Take elements from a tensor along an axis.

maxframe.tensor.choose

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

maxframe.tensor.compress

Return selected slices of a tensor along given axis.

maxframe.tensor.diag

Extract a diagonal or construct a diagonal tensor.

Inserting data into arrays#

maxframe.tensor.fill_diagonal

Fill the main diagonal of the given tensor of any dimensionality.