Tensor.transpose

Tensor.transpose(axes=None)[source]

Return a tensor with axes transposed.

Parameters

axes (tuple[int, ...] | None) – If specified, it must be a tuple or list which contains a permutation of [0,1,…,N-1] where N is the number of axes of the tensor. The i’th axis of the returned tensor will correspond to the axis numbered axes[i] of the input. If not specified, defaults to range(a.ndim)[::-1], which reverses the order of the axes.

Returns

Tensor with it axes permuted.

Return type

Self