Tensor Manipulation Routines#
Basic operations#
Copies values from one array to another, broadcasting as necessary. |
|
Return the number of dimensions of a tensor. |
|
Return the shape of a tensor. |
Changing array shape#
Gives a new shape to a tensor without changing its data. |
|
Return a contiguous flattened tensor. |
|
Return a copy of the tensor collapsed into one dimension. |
Transpose-like operations#
Move axes of a tensor to new positions. |
|
Roll the specified axis backwards, until it lies in a given position. |
|
Interchange two axes of a tensor. |
|
Same as self.transpose(), except that self is returned if self.ndim < 2. |
|
Returns an array with axes transposed. |
Changing number of dimensions#
Convert inputs to tensors with at least one dimension. |
|
View inputs as tensors with at least two dimensions. |
|
View inputs as tensors with at least three dimensions. |
|
Broadcast a tensor to a new shape. |
|
Broadcast any number of arrays against each other. |
|
Expand the shape of a tensor. |
|
Remove single-dimensional entries from the shape of a tensor. |
Joining tensors#
Join a sequence of arrays along an existing axis. |
|
Stack tensors in sequence vertically (row wise). |
Splitting arrays#
Split a tensor into multiple sub-tensors. |
|
Split a tensor into multiple sub-tensors. |
|
Split tensor into multiple sub-tensors along the 3rd axis (depth). |
|
Split a tensor into multiple sub-tensors horizontally (column-wise). |
|
Split a tensor into multiple sub-tensors vertically (row-wise). |
Tiling arrays#
Construct a tensor by repeating A the number of times given by reps. |
|
Repeat elements of a tensor. |
Adding and removing elements#
Return a new array with sub-arrays along an axis deleted. |
|
Insert values along the given axis before the given indices. |
Rearranging elements#
Reverse the order of elements in a tensor along the given axis. |
|
Flip tensor in the left/right direction. |
|
Flip tensor in the up/down direction. |
|
Roll tensor elements along a given axis. |