Skip to content

transpose

Return tensor with transposed axes.

transpose

transpose(tensor: Tensor) -> Tensor

Return a new tensor with all axes reversed.

Parameters:

Name Type Description Default
tensor Tensor

The input tensor to transpose.

required

Returns:

Type Description
Tensor

A new tensor instance with reversed axis order.

Examples:

>>> from nicole import transpose, Tensor
>>> # Assuming t is a 3-index tensor with itags [a, b, c]
>>> t_T = transpose(t)  # Reverse order to [c, b, a]

Description

Returns a fully independent tensor with all axes reversed. All data blocks are deep-copied, so the result is completely isolated from the original.

Note: Tensor.transpose() defaults to in_place=False — it returns a new tensor and leaves the original unchanged. To modify the tensor in place instead, call Tensor.transpose(in_place=True). For arbitrary axis reordering, use permute.

See Also

Notes

Always reverses axis order. For arbitrary reordering, use permute.