maxElement

Computes a max reduction along the specified axes.

maxElement
(,
size_t[] axes = []
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

op Operation

The input to the reduction.

axes size_t[]

The axes the reduction should be performed along.

Return Value

Type: Operation

The resulting operation.

Examples

import dopt.core : evaluate;

auto a = float32([2, 2],[
    1.0f, 4.0f,
    3.0f, 6.0f
]);

assert(a.maxElement.evaluate().get!float == [6.0f]); //Max value in the entire tensor
assert(a.maxElement([0]).evaluate().get!float == [3.0f, 6.0f]); //Max of each column
assert(a.maxElement([1]).evaluate().get!float == [4.0f, 6.0f]); //Max of each row

Meta