Function maxElement

Computes a max reduction along the specified axes.

Operation maxElement (
  Operation op,
  ulong[] axes = [],
  string mod = __MODULE__,
  ulong line = cast(ulong)__LINE__
);

Parameters

NameDescription
op The input to the reduction.
axes The axes the reduction should be performed along.

Returns

The resulting operation.

Example

import dopt.core : evaluate;

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

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