class_docstr: Calculates Cross-entropy loss with label smoothing for a batch of sequences.
  
  SmoothedCrossEntropyLoss:
  1) excludes padding tokens from loss calculation
  2) allows to use label smoothing regularization
  3) allows to calculate loss for the desired number of last tokens
  4) per_token_reduction - if False disables reduction per token
  
  Args:
      label_smoothing (float): label smoothing regularization coefficient
      predict_last_k (int): parameter which sets the number of last tokens to calculate the loss for, for example
          0: (default) calculate loss on the entire sequence (e.g., NMT)
          1: calculate loss on the last token only (e.g., LM evaluation)
          Intermediate values allow to control the trade-off between eval
          time (proportional to the number of batches) and eval performance
          (proportional to the number of context tokens)
      pad_id (int): padding id
      eps (float): the small eps number to avoid division buy zero
class_docstr_tok: ["Calculates","Cross-entropy","loss","with","label","smoothing","for","a","batch","of","sequences",".","SmoothedCrossEntropyLoss",":","1",")","excludes","padding","tokens","from","loss","calculation","2",")","allows","to","use","label","smoothing","regularization","3",")","allows","to","calculate","loss","for","the","desired","number","of","last","tokens","4",")","per_token_reduction","-","if","False","disables","reduction","per","token","Args",":","label_smoothing","(","float",")",":","label","smoothing","regularization","coefficient","predict_last_k","(","int",")",":","parameter","which","sets","the","number","of","last","tokens","to","calculate","the","loss","for",",","for","example","0",":","(","default",")","calculate","loss","on","the","entire","sequence","(","e.g.",",","NMT",")","1",":","calculate","loss","on","the","last","token","only","(","e.g.",",","LM","evaluation",")","Intermediate","values","allow","to","control","the","trade-off","between","eval","time","(","proportional","to","the","number","of","batches",")","and","eval","performance","(","proportional","to","the","number","of","context","tokens",")","pad_id","(","int",")",":","padding","id","eps","(","float",")",":","the","small","eps","number","to","avoid","division","buy","zero"]
docstr: Returns definitions of module output ports.
          
docstr_tok: ["Returns","definitions","of","module","output","ports","."]
code: def output_types(self):
      """Returns definitions of module output ports."""
      return {"loss": NeuralType(elements_type=LossType())}
  
file_path: NeMo/nemo/collections/common/losses/smoothed_cross_entropy.py
imports: from typing import Optional
  import torch
  from nemo.core.classes import Exportable, Loss, NeuralModule, typecheck
  from nemo.core.neural_types import LabelsType, LogprobsType, LossType, MaskType, NeuralType
label_desc: Use image node_id 2 for calling the SmoothedCrossEntropyLoss obj's underlying member method code with example usage: obj.output_types() and returns: dict