reshape

Allows one to cast an operation to a different shape with the same volume.

reshape
(,
size_t[] shape
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

input Operation

The operation to be reshaped.

shape size_t[]

The new shape.

Return Value

Type: Operation

The new Operation.

Examples

import dopt.core : evaluate;

auto r1 = float32([2, 2], [1.0f, 2.0f, 3.0f, 4.0f]).reshape([1, 4]);

assert(r1.shape == [1, 4]);
assert(r1.evaluate().get!float == [1.0f, 2.0f, 3.0f, 4.0f]);

Meta