argminmax

argminmax#

Returns the minimum values, minimum value indices, maximum values, and maximum value indices across the input operator

template<typename InType, int D>
__MATX_INLINE__ auto matx::argminmax(const InType &in, const int (&dims)[D])#

Compute min and max reduction of an operator and returns value + index along specified axes

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 argminmax-reduce computed

template<typename InType>
__MATX_INLINE__ auto matx::argminmax(const InType &in)#

Compute min and max reduction of an operator and returns value + index

Template Parameters:

InType – Input data type

Parameters:

in – Input data to reduce

Returns:

Operator with reduced values of argminmax-reduce computed

Examples#

auto t0min = make_tensor<TestType>({});
auto t0mini = make_tensor<index_t>({});
auto t0max = make_tensor<TestType>({});
auto t0maxi = make_tensor<index_t>({});
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});

(mtie(t0min, t0mini, t0max, t0maxi) = argminmax(t1o)).run(exec);
(matx::mtie(t_c, t_ci, t_b, t_bi) = matx::argminmax(t_a, {1,2})).run(exec);