class_docstr: Simplest RoI head, with only two fc layers for classification and
  regression respectively.
class_docstr_tok: ["Simplest","RoI","head",",","with","only","two","fc","layers","for","classification","and","regression","respectively","."]
docstr: Regress the bbox for the predicted class. Used in Cascade R-CNN.
  
  Args:
      rois (Tensor): shape (n, 4) or (n, 5)
      label (Tensor): shape (n, )
      bbox_pred (Tensor): shape (n, 4*(#class)) or (n, 4)
      img_meta (dict): Image meta info.
  
  Returns:
      Tensor: Regressed bboxes, the same shape as input rois.
docstr_tok: ["Regress","the","bbox","for","the","predicted","class",".","Used","in","Cascade","R-CNN",".","Args",":","rois","(","Tensor",")",":","shape","(","n",",","4",")","or","(","n",",","5",")","label","(","Tensor",")",":","shape","(","n",",",")","bbox_pred","(","Tensor",")",":","shape","(","n",",","4","*","(","#","class",")",")","or","(","n",",","4",")","img_meta","(","dict",")",":","Image","meta","info",".","Returns",":","Tensor",":","Regressed","bboxes",",","the","same","shape","as","input","rois","."]
code: def regress_by_class(self, rois, label, bbox_pred, img_meta):
      """Regress the bbox for the predicted class. Used in Cascade R-CNN.
  
      Args:
          rois (Tensor): shape (n, 4) or (n, 5)
          label (Tensor): shape (n, )
          bbox_pred (Tensor): shape (n, 4*(#class)) or (n, 4)
          img_meta (dict): Image meta info.
  
      Returns:
          Tensor: Regressed bboxes, the same shape as input rois.
      """
      assert rois.size(1) == 4 or rois.size(1) == 5, repr(rois.shape)
  
      if not self.reg_class_agnostic:
          label = label * 4
          inds = torch.stack(
              (label, label + 1, label + 2, label + 3), 1
          )
          bbox_pred = torch.gather(bbox_pred, 1, inds)
      assert bbox_pred.size(1) == 4
  
      if rois.size(1) == 4:
          new_rois = self.bbox_coder.decode(
              rois, bbox_pred, max_shape=img_meta["img_shape"]
          )
      else:
          bboxes = self.bbox_coder.decode(
              rois[:, 1:], bbox_pred, max_shape=img_meta["img_shape"]
          )
          new_rois = torch.cat((rois[:, [0]], bboxes), dim=1)
  
      return new_rois
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/bbox_heads/bbox_head.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.runner import auto_fp16, force_fp32
  from torch.nn.modules.utils import _pair
  from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
  from mmdet.models.builder import HEADS, build_loss
  from mmdet.models.losses import accuracy
label_desc: Use image node_id 9 for calling the BBoxHead obj's underlying member method code with example usage: obj.regress_by_class(rois, label, bbox_pred, img_meta) and returns: new_rois