max#
Reduces the input by the maximum values across the specified axes or performs an element-wise maximum on each element in the input operators.
-
template<typename InType, int D>
__MATX_INLINE__ auto matx::max(const InType &in, const int (&dims)[D])# Compute max reduction of an operator along axes
Returns an operator representing the max of all numbers in the reduction
- Template Parameters:
InType – Input data type
D – Num of dimensions to reduce over
- Parameters:
in – Input data to reduce
dims – Array containing dimensions to reduce over
- Returns:
Operator with reduced values of max-reduce computed
-
template<typename InType>
__MATX_INLINE__ auto matx::max(const InType &in)# Compute max reduction of an operator
Returns an operator representing the max of all numbers in the reduction
- Template Parameters:
InType – Input data type
D – Number of right-most dimensions to reduce over
- Parameters:
in – Input data to reduce
- Returns:
Operator with reduced values of max-reduce computed
-
Op matx::max(Op t, Op t2)#
Compute element-wise max(t, t2) of two operators or tensors
- Parameters:
t – LHS tensor or operator input
t2 – RHS tensor or operator input
Examples#
auto t0 = make_tensor<TestType>({});
auto t1o = make_tensor<TestType>({11});
t1o.SetVals({(T)1, (T)3, (T)8, (T)2, (T)9, (T)10, (T)6, (T)7, (T)4, (T)5, (T)11});
// Reduce all inputs in "t1o" into "t0" by the maximum of all elements
(t0 = max(t1o)).run(exec);
// Reduce a 4D tensor into a 2D tensor by collapsing the inner two dimensions. Both
// examples permute the dimensions before the reduction
(t2a = max(permute(t4,{2,3,0,1}))).run(exec);
(t2b = max(t4, {0,1})).run(exec);
(tov0 = max(tiv0, d)).run(exec);