transpose function

VARP transpose(
  1. VARP x,
  2. List<int> perm
)

Transposes x.

Args:

  • x: A variable.
  • perm: A vector, indicating the permutation of the dimensions of x.

Returns:

  • A transposed variable.

Implementation

VARP transpose(VARP x, List<int> perm) {
  final (permPtr, permSize) = perm.toNativeArrayI32();
  final rval = VARP.fromPointer(C.mnn_expr_Transpose(x.ptr, permPtr.cast(), permSize));
  calloc.free(permPtr);
  return rval;
}