Function transpose

Reorders the dimensions of output of an operation.

Operation transpose (
  Operation input,
  ulong[] order,
  string mod = __MODULE__,
  ulong line = cast(ulong)__LINE__
);

Parameters

NameDescription
input The operation that should have its dimensions reordered.
order Determines how the dimensions are permuted.

Notes

Currently only implemented for rank 2 tensors.

Returns

The new Operation.

Example

import dopt.core : evaluate;

auto t1 = float32([2, 2], [1.0f, 2.0f, 3.0f, 4.0f]).transpose([1, 0]);

assert(t1.evaluate().as!float == [1.0f, 3.0f, 2.0f, 4.0f]);