class_docstr: GaussianFocalLoss is a variant of focal loss.
  
  More details can be found in the `paper
  <https://arxiv.org/abs/1808.01244>`_
  Code is modified from `kp_utils.py
  <https://github.com/princeton-vl/CornerNet/blob/master/models/py_utils/kp_utils.py#L152>`_  # noqa: E501
  Please notice that the target in GaussianFocalLoss is a gaussian heatmap,
  not 0/1 binary target.
  
  Args:
      alpha (float): Power of prediction.
      gamma (float): Power of target for negative samples.
      reduction (str): Options are "none", "mean" and "sum".
      loss_weight (float): Loss weight of current loss.
      pos_weight(float): Positive sample loss weight. Defaults to 1.0.
      neg_weight(float): Negative sample loss weight. Defaults to 1.0.
docstr: Forward function.
  
  If you want to manually determine which positions are
  positive samples, you can set the pos_index and pos_label
  parameter. Currently, only the CenterNet update version uses
  the parameter.
  
  Args:
      pred (torch.Tensor): The prediction. The shape is (N, num_classes).
      target (torch.Tensor): The learning target of the prediction
          in gaussian distribution. The shape is (N, num_classes).
      pos_inds (torch.Tensor): The positive sample index.
          Defaults to None.
      pos_labels (torch.Tensor): The label corresponding to the positive
          sample index. Defaults to None.
      weight (torch.Tensor, optional): The weight of loss for each
          prediction. Defaults to None.
      avg_factor (int, float, optional): Average factor that is used to
          average the loss. Defaults to None.
      reduction_override (str, optional): The reduction method used to
          override the original reduction method of the loss.
          Defaults to None.
docstr_tok: ["Forward","function",".","If","you","want","to","manually","determine","which","positions","are","positive","samples",",","you","can","set","the","pos_index","and","pos_label","parameter",".","Currently",",","only","the","CenterNet","update","version","uses","the","parameter",".","Args",":","pred","(","torch.Tensor",")",":","The","prediction",".","The","shape","is","(","N",",","num_classes",")",".","target","(","torch.Tensor",")",":","The","learning","target","of","the","prediction","in","gaussian","distribution",".","The","shape","is","(","N",",","num_classes",")",".","pos_inds","(","torch.Tensor",")",":","The","positive","sample","index",".","Defaults","to","None",".","pos_labels","(","torch.Tensor",")",":","The","label","corresponding","to","the","positive","sample","index",".","Defaults","to","None",".","weight","(","torch.Tensor",",","optional",")",":","The","weight","of","loss","for","each","prediction",".","Defaults","to","None",".","avg_factor","(","int",",","float",",","optional",")",":","Average","factor","that","is","used","to","average","the","loss",".","Defaults","to","None",".","reduction_override","(","str",",","optional",")",":","The","reduction","method","used","to","override","the","original","reduction","method","of","the","loss",".","Defaults","to","None","."]
code: def forward(
      self,
      pred: Tensor,
      target: Tensor,
      pos_inds: Optional[Tensor] = None,
      avg_factor: Optional[Union[int, float]] = None,
  ) -> Tensor:
      """Forward function.
  
      If you want to manually determine which positions are
      positive samples, you can set the pos_index and pos_label
      parameter. Currently, only the CenterNet update version uses
      the parameter.
  
      Args:
          pred (torch.Tensor): The prediction. The shape is (N, num_classes).
          target (torch.Tensor): The learning target of the prediction
              in gaussian distribution. The shape is (N, num_classes).
          pos_inds (torch.Tensor): The positive sample index.
              Defaults to None.
          pos_labels (torch.Tensor): The label corresponding to the positive
              sample index. Defaults to None.
          weight (torch.Tensor, optional): The weight of loss for each
              prediction. Defaults to None.
          avg_factor (int, float, optional): Average factor that is used to
              average the loss. Defaults to None.
          reduction_override (str, optional): The reduction method used to
              override the original reduction method of the loss.
              Defaults to None.
      """
  
      pos_loss, neg_loss = heatmap_focal_loss_with_pos_inds(
          pred,
          target,
          pos_inds,
          alpha=self.alpha,
          beta=self.beta,
          gamma=self.gamma,
          sigmoid_clamp=self.sigmoid_clamp,
          ignore_high_fp=self.ignore_high_fp,
          pos_weight=self.pos_weight,
          neg_weight=self.neg_weight,
          avg_factor=avg_factor,
      )
      return pos_loss, neg_loss
  
file_path: mmdetection/projects/Detic_new/detic/heatmap_focal_loss.py
imports: from typing import Optional, Union
  import torch
  import torch.nn
  from torch import Tensor
  from mmdet.registry import MODELS
label_desc: Use image node_id 2 for calling the HeatmapFocalLoss obj's underlying member method code with example usage: obj.forward(pred, target, pos_inds, avg_factor) and returns: pos_loss,  neg_loss