Graph.transpose(a, perm=None, *, name=None)

Reorder the dimensions of a tensor.

  • a (np.ndarray or Tensor) – The tensor whose dimensions you want to permute, \(x\).

  • perm (list[int] or None, optional) – The order of the input dimensions for the returned tensor. If you provide it, it must be a permutation of all integers between 0 and N-1, where N is the rank of a. If you don’t provide it, the order of the dimensions is inverted, that is to say, it defaults to [N-1, …, 1, 0].

  • name (str or None, optional) – The name of the node.


The input tensor with its dimensions permuted. The i-th dimension of the returned tensor corresponds to the perm[i]-th input dimension.

Return type:


See also


Hermitian adjoint of an operator.


Tensor contraction via Einstein summation convention.