Mojo module
reduction
Implements SIMD reductions.
You can import these APIs from the algorithm package. For example:
from algorithm import map_reduceFunctions
-
all_true: Returns True if all the elements in a buffer are True and False otherwise. -
any_true: Returns True if any the elements in a buffer are True and False otherwise. -
cumsum: Computes the cumulative sum of all elements in a buffer. dst[i] = src[i] + src[i-1] + ... + src[0]. -
map_reduce: Stores the result of calling input_gen_fn in dst and simultaneously reduce the result using a custom reduction function. -
max: Computes the max element in a buffer. -
mean: Computes the mean value of the elements in a buffer. -
min: Computes the min element in a buffer. -
none_true: Returns True if none of the elements in a buffer are True and False otherwise. -
product: Computes the product of the buffer elements. -
reduce: Computes a custom reduction of buffer elements. -
reduce_boolean: Computes a bool reduction of buffer elements. The reduction will early exit if thecontinue_fnreturns False. -
sum: Computes the sum of buffer elements. -
variance: Given a mean, computes the variance of elements in a buffer.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!