argmin#

Returns both the minimum values and the indices of the minimum values across the input operator

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

Compute min reduction of a tensor 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 argmin-reduce computed

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

Compute min reduction of a tensor and returns value + index

Template Parameters:

InType – Input data type

Parameters:

in – Input data to reduce

Returns:

Operator with reduced values of argmin-reduce computed

Examples#

auto t0 = make_tensor<TestType>({});
auto t0i = 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(t0, t0i) = argmin(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
(mtie(t2a, t2ai) = argmin(permute(t4,{2,3,0,1}))).run(exec);
(mtie(t2b, t2bi) = argmin(t4, {0,1})).run(exec);