class_docstr: FocalLossCost.
  
  Args:
      weight (int | float, optional): loss_weight
      alpha (int | float, optional): focal_loss alpha
      gamma (int | float, optional): focal_loss gamma
      eps (float, optional): default 1e-12
      binary_input (bool, optional): Whether the input is binary,
         default False.
class_docstr_tok: ["FocalLossCost",".","Args",":","weight","(","int","|","float",",","optional",")",":","loss_weight","alpha","(","int","|","float",",","optional",")",":","focal_loss","alpha","gamma","(","int","|","float",",","optional",")",":","focal_loss","gamma","eps","(","float",",","optional",")",":","default","1e-12","binary_input","(","bool",",","optional",")",":","Whether","the","input","is","binary",",","default","False","."]
docstr: Args:
      cls_pred (Tensor): Predicted classification logits, shape
          (num_query, num_class).
      gt_labels (Tensor): Label of `gt_bboxes`, shape (num_gt,).
  
  Returns:
      paddle.Tensor: cls_cost value with weight
docstr_tok: ["Args",":","cls_pred","(","Tensor",")",":","Predicted","classification","logits",",","shape","(","num_query",",","num_class",")",".","gt_labels","(","Tensor",")",":","Label","of","`","gt_bboxes","`",",","shape","(","num_gt",",",")",".","Returns",":","paddle.Tensor",":","cls_cost","value","with","weight"]
code: def _focal_loss_cost(self, cls_pred, gt_labels):
      """
      Args:
          cls_pred (Tensor): Predicted classification logits, shape
              (num_query, num_class).
          gt_labels (Tensor): Label of `gt_bboxes`, shape (num_gt,).
  
      Returns:
          paddle.Tensor: cls_cost value with weight
      """
      if gt_labels.size == 0:
          return cls_pred.sum() * 0
      cls_pred = F.sigmoid(cls_pred)
      neg_cost = (
          -(1 - cls_pred + self.eps).log()
          * (1 - self.alpha)
          * cls_pred.pow(self.gamma)
      )
      pos_cost = (
          -(cls_pred + self.eps).log()
          * self.alpha
          * (1 - cls_pred).pow(self.gamma)
      )
  
      cls_cost = paddle.index_select(
          pos_cost, gt_labels, axis=1
      ) - paddle.index_select(neg_cost, gt_labels, axis=1)
      return cls_cost * self.weight
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import paddle
  import paddle.nn.functional
  from ppdet.core.workspace import register
label_desc: Use image node_id 2 for calling the FocalLossCost obj's underlying member method code with example usage: obj._focal_loss_cost(cls_pred, gt_labels) and returns: unknown, unknown