class_docstr: Cross entropy loss function for image classification tasks
  
  Args:
      opts: command-line arguments
class_docstr_tok: ["Cross","entropy","loss","function","for","image","classification","tasks","Args",":","opts",":","command-line","arguments"]
docstr: Add cross-entropy criterion-specific arguments to the parser.
docstr_tok: ["Add","cross-entropy","criterion-specific","arguments","to","the","parser","."]
code: def add_arguments(
      cls, parser: argparse.ArgumentParser
  ) -> argparse.ArgumentParser:
      """Add cross-entropy criterion-specific arguments to the parser."""
      if cls != CrossEntropy:
          # Don't re-register arguments in subclasses that don't override `add_arguments()`.
          return parser
      group = parser.add_argument_group(title=cls.__name__)
      group.add_argument(
          "--loss.classification.cross-entropy.class-weights",
          action="store_true",
          default=False,
          help=f"Use class weights in {cls.__name__}. Defaults to False.",
      )
      group.add_argument(
          "--loss.classification.cross-entropy.ignore-index",
          type=int,
          default=-1,
          help=f"Target value that is ignored and does not contribute to "
          f"the input gradient in {cls.__name__}. Defaults to -1.",
      )
      group.add_argument(
          "--loss.classification.cross-entropy.label-smoothing",
          type=float,
          default=0.0,
          help=f"Specifies the amount of smoothing when computing the loss in {cls.__name__}, "
          f"where 0.0 means no smoothing. Defaults to 0.0.",
      )
      return parser
  
file_path: ml-cvnets/loss_fn/classification/cross_entropy.py
imports: import argparse
  from torch import Tensor
  from torch.nn import functional
  from loss_fn import LOSS_REGISTRY
  from loss_fn.classification.base_classification_criteria import BaseClassificationCriteria
  from loss_fn.utils.class_weighting import compute_class_weights
label_desc: Use image node_id 2 for calling the CrossEntropy obj's underlying member method code with example usage: obj.add_arguments(cls, parser) and returns: parser, parser