Criterions¶
Criterions compute the loss function given the model and batch, roughly:
loss = criterion(model, batch)

class
fairseq.criterions.
FairseqCriterion
(args, task)[source]¶ 

static
aggregate_logging_outputs
(logging_outputs)[source]¶ Aggregate logging outputs from data parallel training.

static

class
fairseq.criterions.adaptive_loss.
AdaptiveLoss
(args, task)[source]¶ This is an implementation of the loss function accompanying the adaptive softmax approximation for graphical processing units (GPU), described in the paper “Efficient softmax approximation for GPUs” (http://arxiv.org/abs/1609.04309).

class
fairseq.criterions.composite_loss.
CompositeLoss
(args, task)[source]¶ This is a composite loss that, given a list of model outputs and a list of targets, computes an average of losses for each outputtarget pair

class
fairseq.criterions.cross_entropy.
CrossEntropyCriterion
(args, task)[source]¶