tensor.transpose(new_ordering, new_format=None, name=None)

Transposes a tensor.

Returns a new tensor with the shape reordered by the new_ordering list passed in.

new_ordering: iter

The ordering for the new tensor shape. The shape of the new_tensor is given by self.shape permuted by new_ordering.

new_format:class:format, optional

The format of the new tensor. This follows the same rules for tensor initialization. If the format is not specified the tensor will have the same format as this tensor.

name: str, optional

The name of the output tensor. The same as in the tensor constructor.

t_tensor: tensor

A tensor whose dimensions have been transposed by new_ordering with format new_format if specified and name name if specified.


This function always returns a new tensor regardless of if it is dense.