Tinkex.MetricsReduction (Tinkex v0.3.4)
View SourceMetric reduction for chunked forward/backward results.
Mirrors Python's chunked_fwdbwd_helpers._metrics_reduction helper by
reducing metrics based on the suffix that comes after the last : in the
metric name. Only metrics present in the first chunk are considered, and keys
missing from later chunks are ignored (they are not treated as zero).
Summary
Functions
Reduce metrics from chunked forward/backward results.
Types
Functions
@spec reduce([Tinkex.Types.ForwardBackwardOutput.t()]) :: metrics()
Reduce metrics from chunked forward/backward results.
- Weights use the number of
loss_fn_outputsfor each chunk. - Unknown suffixes fall back to the weighted mean reducer.
:uniquemetrics retain every value by emitting suffixed keys (key_2,key_3, ...).- Weighted reducers return
0.0when the total weight is0. :hash_unorderedreturns an integer hash (not a float) for order-insensitive identity checks. Suitable for verifying batch composition across distributed chunks.