permute#
Permute the dimensions of an operator
Added in version 0.3.0.
-
template<typename T>
__MATX_INLINE__ auto matx::permute(const T &op, const int32_t (&dims)[T::Rank()])# Operator to permute the dimensions of a tensor or operator.
Each dimension must appear in the dims array once, otherwise matxInvalidDim is thrown.
This operator can appear as an rvalue or lvalue.
- Template Parameters:
T – Input operator/tensor type
- Parameters:
op – Input operator
dims – the reordered dimensions of the operator.
- Returns:
permuted operator
-
template<typename T>
__MATX_INLINE__ auto matx::permute(const T &op, const cuda::std::array<int32_t, T::Rank()> &dims)#
Examples#
// Permute from dims {0, 1, 2} to {2, 0, 1}
auto op = permute(A, {2, 0, 1});
Adjacent permutations of expressions are composed into a single permutation. Inverse permutations therefore restore the original mapping, including for in-place element-wise operations with unsafe alias detection enabled. A non-identity combined permutation that reads the destination remains unsafe. Each permutation’s axes are validated before composition.