median#
Compute the median of the reduction dimensions
-
template<typename InType, int D>
__MATX_INLINE__ auto matx::median(const InType &in, const int (&dims)[D])# Calculate the median of values in an operator along axes
Calculates the median of rows in an operator. The median is computed by sorting the data into a temporary tensor, then picking the middle element of each row. For an even number of items, the mean of the two middle elements is selected. Currently only works on tensor views as input since it uses CUB sorting as a backend, and the tensor views must be rank 2 reducing to rank 1, or rank 1 reducing to rank 0.
- 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 median-reduce computed
-
template<typename InType>
__MATX_INLINE__ auto matx::median(const InType &in)# Calculate the median of values in an operator
Calculates the median of rows in an operator. The median is computed by sorting the data into a temporary tensor, then picking the middle element of each row. For an even number of items, the mean of the two middle elements is selected. Currently only works on tensor views as input since it uses CUB sorting as a backend, and the tensor views must be rank 2 reducing to rank 1, or rank 1 reducing to rank 0.
- Template Parameters:
InType – Input data type
- Parameters:
in – Input data to reduce
- Returns:
Operator with reduced values of median-reduce computed
Examples#
// Compute media over all elements in "t1e" and store result in "t0"
(t0 = median(t1e)).run(exec);