class_docstr: CrossEntropyLossCost.
  
  Args:
      use_sigmoid (bool): Whether the prediction uses sigmoid
              of softmax. Defaults to True.
      weight (Union[float, int]): Cost weight. Defaults to 1.
class_docstr_tok: ["CrossEntropyLossCost",".","Args",":","use_sigmoid","(","bool",")",":","Whether","the","prediction","uses","sigmoid","of","softmax",".","Defaults","to","True",".","weight","(","Union","[","float",",","int","]",")",":","Cost","weight",".","Defaults","to","1","."]
docstr: Args:
      cls_pred (Tensor): The prediction with shape (num_queries, 1, *) or
          (num_queries, *).
      gt_labels (Tensor): The learning label of prediction with
          shape (num_gt, *).
  
  Returns:
      Tensor: Cross entropy cost matrix in shape (num_queries, num_gt).
code: def _binary_cross_entropy(
      self, cls_pred: Tensor, gt_labels: Tensor
  ) -> Tensor:
      """
      Args:
          cls_pred (Tensor): The prediction with shape (num_queries, 1, *) or
              (num_queries, *).
          gt_labels (Tensor): The learning label of prediction with
              shape (num_gt, *).
  
      Returns:
          Tensor: Cross entropy cost matrix in shape (num_queries, num_gt).
      """
      cls_pred = cls_pred.flatten(1).float()
      gt_labels = gt_labels.flatten(1).float()
      n = cls_pred.shape[1]
      pos = F.binary_cross_entropy_with_logits(
          cls_pred, torch.ones_like(cls_pred), reduction="none"
      )
      neg = F.binary_cross_entropy_with_logits(
          cls_pred, torch.zeros_like(cls_pred), reduction="none"
      )
      cls_cost = torch.einsum(
          "nc,mc->nm", pos, gt_labels
      ) + torch.einsum("nc,mc->nm", neg, 1 - gt_labels)
      cls_cost = cls_cost / n
  
      return cls_cost
  
imports: from abc import abstractmethod
  from typing import Optional, Union
  import torch
  import torch.nn.functional
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import bbox_overlaps, bbox_xyxy_to_cxcywh
label_desc: Use image node_id 2 for calling the CrossEntropyLossCost obj's underlying member method code with example usage: obj._binary_cross_entropy(cls_pred, gt_labels) and returns: cls_cost