Tensor Manipulation Routines#

Basic operations#

maxframe.tensor.copyto

Copies values from one array to another, broadcasting as necessary.

maxframe.tensor.ndim

Return the number of dimensions of a tensor.

maxframe.tensor.shape

Return the shape of a tensor.

Changing array shape#

maxframe.tensor.reshape

Gives a new shape to a tensor without changing its data.

maxframe.tensor.ravel

Return a contiguous flattened tensor.

maxframe.tensor.core.Tensor.flatten

Return a copy of the tensor collapsed into one dimension.

Transpose-like operations#

maxframe.tensor.moveaxis

Move axes of a tensor to new positions.

maxframe.tensor.rollaxis

Roll the specified axis backwards, until it lies in a given position.

maxframe.tensor.swapaxes

Interchange two axes of a tensor.

maxframe.tensor.core.Tensor.T

Same as self.transpose(), except that self is returned if self.ndim < 2.

maxframe.tensor.transpose

Returns an array with axes transposed.

Changing number of dimensions#

maxframe.tensor.atleast_1d

Convert inputs to tensors with at least one dimension.

maxframe.tensor.atleast_2d

View inputs as tensors with at least two dimensions.

maxframe.tensor.atleast_3d

View inputs as tensors with at least three dimensions.

maxframe.tensor.broadcast_to

Broadcast a tensor to a new shape.

maxframe.tensor.broadcast_arrays

Broadcast any number of arrays against each other.

maxframe.tensor.expand_dims

Expand the shape of a tensor.

maxframe.tensor.squeeze

Remove single-dimensional entries from the shape of a tensor.

Joining tensors#

maxframe.tensor.concatenate

Join a sequence of arrays along an existing axis.

maxframe.tensor.vstack

Stack tensors in sequence vertically (row wise).

Splitting arrays#

maxframe.tensor.split

Split a tensor into multiple sub-tensors.

maxframe.tensor.array_split

Split a tensor into multiple sub-tensors.

maxframe.tensor.dsplit

Split tensor into multiple sub-tensors along the 3rd axis (depth).

maxframe.tensor.hsplit

Split a tensor into multiple sub-tensors horizontally (column-wise).

maxframe.tensor.vsplit

Split a tensor into multiple sub-tensors vertically (row-wise).

Tiling arrays#

maxframe.tensor.tile

Construct a tensor by repeating A the number of times given by reps.

maxframe.tensor.repeat

Repeat elements of a tensor.

Adding and removing elements#

maxframe.tensor.delete

Return a new array with sub-arrays along an axis deleted.

maxframe.tensor.insert

Insert values along the given axis before the given indices.

Rearranging elements#

maxframe.tensor.flip

Reverse the order of elements in a tensor along the given axis.

maxframe.tensor.fliplr

Flip tensor in the left/right direction.

maxframe.tensor.flipud

Flip tensor in the up/down direction.

maxframe.tensor.roll

Roll tensor elements along a given axis.