CrossEntropy#

class composer.metrics.CrossEntropy(ignore_index=- 100, dist_sync_on_step=False)[source]#

Torchmetrics cross entropy loss implementation.

This class implements cross entropy loss as a torchmetrics.Metric so that it can be returned by the metrics().

Parameters
  • ignore_index (int, optional) โ€“ Specifies a target value that is ignored and does not contribute to the input gradient. ignore_index is only applicable when the target contains class indices. Default: -100.

  • 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.