class_docstr: 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_docstr_tok: ["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",")","."]
code: def build_criterion(cls, cfg: AdaptiveLossConfig, task):
      if cfg.ddp_backend in {"c10d", "pytorch_ddp"}:
          raise Exception(
              "AdaptiveLoss is not compatible with the PyTorch "
              "version of DistributedDataParallel. Please use "
              "`--ddp-backend=legacy_ddp` instead."
          )
      return cls(task, cfg.sentence_avg)
  
file_path: fairseq/fairseq/criterions/adaptive_loss.py
imports: import math
  from dataclasses import dataclass
  import torch.nn.functional
  from fairseq import utils
  from fairseq.logging import metrics
  from fairseq.criterions import FairseqCriterion, register_criterion
  from fairseq.dataclass import FairseqDataclass
  from fairseq.dataclass.constants import DDP_BACKEND_CHOICES
  from omegaconf import II
label_desc: Use image node_id 2 for calling the AdaptiveLoss obj's underlying member method code with example usage: obj.build_criterion(cls, cfg, task) and returns: cls