class_docstr: Neural module which implements loss for SGD model.
class_docstr_tok: ["Neural","module","which","implements","loss","for","SGD","model","."]
docstr: Args:
      reduction: specifies the reduction to apply to the final loss, choose 'mean' or 'sum'
docstr_tok: ["Args",":","reduction",":","specifies","the","reduction","to","apply","to","the","final","loss",",","choose","'mean","'","or","'sum","'"]
code: def __init__(self, reduction: str = "mean"):
      """
      Args:
          reduction: specifies the reduction to apply to the final loss, choose 'mean' or 'sum'
      """
      super().__init__()
  
      if reduction not in ["mean", "sum"]:
          logging.warning(
              f'{reduction} reduction is not supported. Setting reduction to "mean"'
          )
          reduction = "mean"
  
      self.reduction = reduction
      self._cross_entropy = torch.nn.CrossEntropyLoss(
          reduction=self.reduction
      )
      self._cross_entropy_bin = torch.nn.BCEWithLogitsLoss(
          reduction=self.reduction
      )
  
file_path: NeMo/nemo/collections/nlp/losses/sgd_loss.py
imports: import torch
  from nemo.core.classes import Loss, Typing, typecheck
  from nemo.core.neural_types import ChannelType, LabelsType, LogitsType, LossType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 3 to create a new SGDDialogueStateLoss object from inherited base classes: Loss, Typing with example: obj = SGDDialogueStateLoss(reduction)