transpose

Reorders the dimensions of output of an operation.

transpose
(
,
size_t[] order
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

input
Type: Operation

The operation that should have its dimensions reordered.

order
Type: size_t[]

Determines how the dimensions are permuted.

Notes: Currently only implemented for rank 2 tensors.

Return Value

Type: Operation

The new Operation.

Examples

1 import dopt.core : evaluate;
2 
3 auto t1 = float32([2, 2], [1.0f, 2.0f, 3.0f, 4.0f]).transpose([1, 0]);
4 
5 assert(t1.evaluate().as!float == [1.0f, 3.0f, 2.0f, 4.0f]);

Meta