class_docstr: Criterion that computes Focal loss.
  
  According to [1], the Focal loss is computed as follows:
  
  .. math::
  
      \text{FL}(p_t) = -\alpha_t (1 - p_t)^{\gamma} \, \text{log}(p_t)
  
  where:
     - :math:`p_t` is the model's estimated probability for each class.
  
  
  Arguments:
      alpha (float): Weighting factor :math:`\alpha \in [0, 1]`.
      gamma (float): Focusing parameter :math:`\gamma >= 0`.
      reduction (str, optional): Specifies the reduction to apply to the
       output: ‘none’ | ‘mean’ | ‘sum’. ‘none’: no reduction will be applied,
       ‘mean’: the sum of the output will be divided by the number of elements
       in the output, ‘sum’: the output will be summed. Default: ‘none’.
  
  Shape:
      - Input: :math:`(N, C, *)` where C = number of classes.
      - Target: :math:`(N, *)` where each value is
        :math:`0 ≤ targets[i] ≤ C−1`.
  
  Examples:
      >>> N = 5  # num_classes
      >>> kwargs = {"alpha": 0.5, "gamma": 2.0, "reduction": 'mean'}
      >>> loss = kornia.losses.FocalLoss(**kwargs)
      >>> input = torch.randn(1, N, 3, 5, requires_grad=True)
      >>> target = torch.empty(1, 3, 5, dtype=torch.long).random_(N)
      >>> output = loss(input, target)
      >>> output.backward()
  
  References:
      [1] https://arxiv.org/abs/1708.02002
class_docstr_tok: ["Criterion","that","computes","Focal","loss",".","According","to","[","1","]",",","the","Focal","loss","is","computed","as","follows",":","..","math",":",":","\\text","{","FL","}","(","p_t",")","=","-\\alpha_t","(","1","-","p_t",")","^","{","\\gamma","}","\\",",","\\text","{","log","}","(","p_t",")","where",":","-",":","math",":","`","p_t","`","is","the","model","'s","estimated","probability","for","each","class",".","Arguments",":","alpha","(","float",")",":","Weighting","factor",":","math",":","`","\\alpha","\\in","[","0",",","1","]","`",".","gamma","(","float",")",":","Focusing","parameter",":","math",":","`","\\gamma",">","=","0","`",".","reduction","(","str",",","optional",")",":","Specifies","the","reduction","to","apply","to","the","output",":","\u2018","none","\u2019","|","\u2018","mean","\u2019","|","\u2018","sum","\u2019",".","\u2018","none","\u2019",":","no","reduction","will","be","applied",",","\u2018","mean","\u2019",":","the","sum","of","the","output","will","be","divided","by","the","number","of","elements","in","the","output",",","\u2018","sum","\u2019",":","the","output","will","be","summed",".","Default",":","\u2018","none","\u2019",".","Shape",":","-","Input",":",":","math",":","`","(","N",",","C",",","*",")","`","where","C","=","number","of","classes",".","-","Target",":",":","math",":","`","(","N",",","*",")","`","where","each","value","is",":","math",":","`","0","\u2264","targets","[","i","]","\u2264","C\u22121","`",".","Examples",":",">",">",">","N","=","5","#","num_classes",">",">",">","kwargs","=","{","``","alpha","''",":","0.5",",","``","gamma","''",":","2.0",",","``","reduction","''",":","'mean","'","}",">",">",">","loss","=","kornia.losses.FocalLoss","(","*","*","kwargs",")",">",">",">","input","=","torch.randn","(","1",",","N",",","3",",","5",",","requires_grad=True",")",">",">",">","target","=","torch.empty","(","1",",","3",",","5",",","dtype=torch.long",")",".random_","(","N",")",">",">",">","output","=","loss","(","input",",","target",")",">",">",">","output.backward","(",")","References",":","[","1","]","https",":","\/\/arxiv.org\/abs\/1708.02002"]
code: def forward(  # type: ignore
      self, input: paddle.Tensor, target: paddle.Tensor
  ) -> paddle.Tensor:
      return focal_loss(
          input,
          target,
          self.alpha,
          self.gamma,
          self.reduction,
          self.eps,
      )
  
file_path: PaddleDetection/ppdet/modeling/losses/clrnet_loss.py
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from ppdet.modeling.clrnet_utils import accuracy
  from ppdet.modeling.assigners.clrnet_assigner import assign
  from ppdet.modeling.losses.clrnet_line_iou_loss import liou_loss
label_desc: Use image node_id 2 for calling the FocalLoss obj's underlying member method code with example usage: obj.forward(input, target) and returns: focal_loss