spekk.transformations.reduce

spekk.transformations.reduce#

Reduce transforms a function that works on scalar inputs such that it works on arrays instead and iteratively reduces the values of a dimension. For example, Reduce.Sum("dimension") produces equivalent results as a ForAll("dimension") followed by an Apply(np.sum, "dimension") transformation, but will potentially use less memory because it sums the partial results iteratively isntead of trying to parallelize over the dimension first (in the case of using GPU-backends such as JAX).

Functions

specced_map_reduce(map_f, reduce_f, data, ...)

Classes

Reduce(dimension, reduce_fn, ...)

Transform a function to make it reduce the values of a dimension iteratively.