any#

Returns a truth value if any value in the reduction converts to a boolean “true”

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

Find if any value is != 0

Returns a boolean value indicating whether any value in the set of inputs are non-zero. The same aggregation rules apply for input vs output tensor size and what type of reduction is done.

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

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

Find if any value is != 0

Returns a boolean value indicating whether any value in the set of inputs are non-zero. The same aggregation rules apply for input vs output tensor size and what type of reduction is done.

Template Parameters:

InType – Input data type

Parameters:

in – Input data to reduce

Returns:

Operator with reduced values of any-reduce computed

Examples#

// Reduce a 4D tensor into a single output (0D) tensor indicating whether any values were 
// convertible to "true"
(t0 = any(t4)).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 = any(permute(t4,{2,3,0,1}))).run(exec);
(t2b = any(t4, {0,1})).run(exec);