class_docstr: Implements a combined loss from translation and target words prediction.
  
  References:
    [1] https://research.google.com/pubs/archive/37180.pdf
    [2] https://arxiv.org/abs/1708.01771
    [3] https://discuss.pytorch.org/t/writing-warp-loss-layer/3715
  
  TODO(T38581791):
    Although this implementation is faster than [3] (3s/it vs 70s/it), it is
    still much slower than `WordPredictionCriterion`.
    Need to explore ways to speed it up -- it looks like the training time
    increases after each iteration. This happens because it becomes harder
    to search after each update.
class_docstr_tok: ["Implements","a","combined","loss","from","translation","and","target","words","prediction",".","References",":","[","1","]","https",":","\/\/research.google.com\/pubs\/archive\/37180.pdf","[","2","]","https",":","\/\/arxiv.org\/abs\/1708.01771","[","3","]","https",":","\/\/discuss.pytorch.org\/t\/writing-warp-loss-layer\/3715","TODO","(","T38581791",")",":","Although","this","implementation","is","faster","than","[","3","]","(","3s\/it","vs","70s\/it",")",",","it","is","still","much","slower","than","`","WordPredictionCriterion","`",".","Need","to","explore","ways","to","speed","it","up","--","it","looks","like","the","training","time","increases","after","each","iteration",".","This","happens","because","it","becomes","harder","to","search","after","each","update","."]
code: def __init__(self, task, sentence_avg, label_smoothing):
      super().__init__(task, sentence_avg, label_smoothing)
      self.rank_weights = 0.0
  
imports: import abc
  import math
  import torch
  from fairseq import utils
  from fairseq.criterions import register_criterion
  from fairseq.criterions.label_smoothed_cross_entropy import LabelSmoothedCrossEntropyCriterion
  from pytorch_translate.utils import maybe_cuda
label_desc: Use image node_id 1 to create a new WARPLossCriterion object from inherited base classes: _BasePredictionCriterion with example: obj = WARPLossCriterion(task, sentence_avg, label_smoothing)