Skip to content

Aggregation Metrics

The d9d framework includes fundamental aggregation metrics designed to safely compute global statistics and reductions across distributed training environments.

d9d.metric.impl.aggregation.SumMetric

Bases: Metric[Tensor]

Computes the sum of input values.

__init__()

Constructs a SumMetric object.

update(value)

Updates the metric state by adding the sum of the input value.

Parameters:

Name Type Description Default
value Tensor

A tensor whose sum will be added to the accumulator.

required

d9d.metric.impl.aggregation.WeightedMeanMetric

Bases: Metric[Tensor]

Computes the weighted mean of values.

Tracks the sum of weighted values and the sum of weights.

accumulated_weight property

Returns the total weight accumulated so far.

Returns:

Type Description
Tensor

Scalar tensor with total weight.

__init__()

Constructs a WeightedMeanMetric object.