Skip to main content

ClikaRT::ops::permute

function

permute()

Tensor permute(Tensor x, ClikaRT::Span<const std::int64_t> dims)

Reorder the dims by dims, a permutation of [0, rank).

Returns a VIEW (metadata only, no copy). A kernel that later needs dense data materializes internally; no contiguous call is needed here.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when dims is not a permutation of the input's dims (code_name() carries the reason).

Returns: a view of x with reordered dims.

auto nhwc = ClikaRT::ops::permute(nchw, {0, 2, 3, 1}); // no copy

Declared in ClikaRT/compute/ops.h, line 3283