fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py

Killed 0 out of 6 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 2686

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -11,7 +11,7 @@
 from .label_smoothed_cross_entropy import LabelSmoothedCrossEntropyCriterion
 
 
-@register_criterion('label_smoothed_cross_entropy_with_alignment')
+@register_criterion('XXlabel_smoothed_cross_entropy_with_alignmentXX')
 class LabelSmoothedCrossEntropyCriterionWithAlignment(LabelSmoothedCrossEntropyCriterion):
 
     def __init__(self, task, sentence_avg, label_smoothing, alignment_lambda):

Mutant 2687

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -10,8 +10,6 @@
 
 from .label_smoothed_cross_entropy import LabelSmoothedCrossEntropyCriterion
 
-
-@register_criterion('label_smoothed_cross_entropy_with_alignment')
 class LabelSmoothedCrossEntropyCriterionWithAlignment(LabelSmoothedCrossEntropyCriterion):
 
     def __init__(self, task, sentence_avg, label_smoothing, alignment_lambda):

Mutant 2688

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -18,7 +18,6 @@
         super().__init__(task, sentence_avg, label_smoothing)
         self.alignment_lambda = alignment_lambda
 
-    @staticmethod
     def add_args(parser):
         """Add criterion-specific arguments to the parser."""
         LabelSmoothedCrossEntropyCriterion.add_args(parser)

Mutant 2689

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -25,7 +25,7 @@
         parser.add_argument('--alignment-lambda', default=0.05, type=float, metavar='D',
                             help='weight for the alignment loss')
 
-    def forward(self, model, sample, reduce=True):
+    def forward(self, model, sample, reduce=False):
         """Compute the loss for the given sample.
 
         Returns a tuple with three elements:

Mutant 2690

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -73,7 +73,6 @@
 
         return loss
 
-    @staticmethod
     def reduce_metrics(logging_outputs) -> None:
         """Aggregate logging outputs from data parallel training."""
         loss_sum = utils.item(sum(log.get('loss', 0) for log in logging_outputs))

Mutant 2691

--- fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
+++ fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py
@@ -87,7 +87,6 @@
         metrics.log_scalar('alignment_loss', alignment_loss_sum / sample_size / math.log(2), sample_size, round=3)
         metrics.log_derived('ppl', lambda meters: utils.get_perplexity(meters['nll_loss'].avg))
 
-    @staticmethod
     def logging_outputs_can_be_summed() -> bool:
         """
         Whether the logging outputs returned by `forward` can be summed