static OperationNamespace.transpose(a, perm=None, *, name=None)

Returns the input tensor with its dimensions reordered.

  • 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.


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