triton.language.permute

triton.language.permute(input, *dims)

Permutes the dimensions of a tensor.

Parameters:
  • input (Block) – The input tensor.

  • dims – The desired ordering of dimensions. For example, (2, 1, 0) reverses the order dims in a a 3D tensor.

dims can be passed as a tuple or as individual parameters:

# These are equivalent
permute(x, (2, 1, 0))
permute(x, 2, 1, 0)

trans() is equivalent to this function, except when dims is empty, it tries to do a (1,0) permutation.

This function can also be called as a member function on tensor, as x.permute(...) instead of permute(x, ...).