Mojo module
reduction
Implements SIMD reductions.
You can import these APIs from the algorithm package. For example:
from std.algorithm import map_reduceFunctions
-
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 across the input and output shape. -
mean: Computes the mean across the input and output shape. -
min: Computes the min across the input and output shape. -
product: Computes the product across the input and output shape. This performs the product computation on the domain specified byinput_shape, loading the inputs using theinput_fn. The results are stored using theoutput_fn. -
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 across the input and output shape. -
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!