class_docstr: Uses the model's assessment of how likely the correct answer is
  to weight the loss for a each error
  
  multi-category focal loss, in other words
  
  from "Focal Loss for Dense Object Detection"
  
  https://arxiv.org/abs/1708.02002
class_docstr_tok: ["Uses","the","model","'s","assessment","of","how","likely","the","correct","answer","is","to","weight","the","loss","for","a","each","error","multi-category","focal","loss",",","in","other","words","from","``","Focal","Loss","for","Dense","Object","Detection","''","https",":","\/\/arxiv.org\/abs\/1708.02002"]
code: def __init__(self, reduction="mean", gamma=2.0):
      super().__init__()
      if reduction not in ("sum", "none", "mean"):
          raise ValueError("Unknown reduction: %s" % reduction)
  
      self.reduction = reduction
      self.ce_loss = nn.CrossEntropyLoss(reduction="none")
      self.gamma = gamma
  
file_path: stanza/stanza/models/common/loss.py
imports: import logging
  import numpy
  import torch
  import torch.nn
  import stanza.models.common.seq2seq_constant
label_desc: Use image node_id 1 to create a new FocalLoss object from inherited base classes: nn with example: obj = FocalLoss(reduction, gamma)