LossMetric#

class composer.metrics.LossMetric(loss_function, dist_sync_on_step=False)[source]#

Turns a torch.nn Loss Module into distributed torchmetrics Metric.

Parameters
  • loss_function (callable) โ€“ loss function to compute and track.

  • dist_sync_on_step (bool, optional) โ€“ sync distributed metrics every step. Default: False.

compute()[source]#

Aggregate state over all processes and compute the metric.

update(preds, targets)[source]#

Update the state with new predictions and targets.