transpose

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

Returns the input tensor with its dimensions reordered.

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

  • perm (list[int] or np.ndarray(int), 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, optional) – The name of the node.

Returns

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

Tensor

See also

adjoint()

Hermitian adjoint of an operator.

einsum()

Tensor contraction via Einstein summation convention.