transpose#

Fully qualified name: isaacsim::common::array::transpose

Array isaacsim::common::array::transpose(
const Array &a,
const std::optional<std::vector<int64_t>> &axes = std::nullopt,
)#

Permutes an array’s axes.

Axis i of the result is axis axes[i] of the operand, so the result has shape {a.shape()[axes[0]], a.shape()[axes[1]], ...}. axes must be a permutation of [0, a.ndim()); negative entries count from the last axis, as elsewhere in this library. Omitting axes reverses the axis order, so a 0-D or 1-D operand comes back unchanged. The result keeps the operand’s dtype and device, and holds a copy rather than a view of the elements.

Parameters:
  • a – [in] Operand.

  • axes – [in] Permutation of the operand’s axes, one entry per dimension, or std::nullopt to reverse the axis order.

Throws:

std::invalid_argument – if axes does not hold exactly one entry per dimension of a, if any entry is out of range, or if any axis is repeated.

Returns:

A new Array holding the permuted elements.