class_docstr: Side-Aware Boundary Localization (SABL) for RetinaNet.
  
  The anchor generation, assigning and sampling in SABLRetinaHead
  are the same as GuidedAnchorHead for guided anchoring.
  
  Please refer to https://arxiv.org/abs/1912.04260 for more details.
  
  Args:
      num_classes (int): Number of classes.
      in_channels (int): Number of channels in the input feature map.
      stacked_convs (int): Number of Convs for classification             and regression branches. Defaults to 4.
      feat_channels (int): Number of hidden channels.             Defaults to 256.
      approx_anchor_generator (dict): Config dict for approx generator.
      square_anchor_generator (dict): Config dict for square generator.
      conv_cfg (dict): Config dict for ConvModule. Defaults to None.
      norm_cfg (dict): Config dict for Norm Layer. Defaults to None.
      bbox_coder (dict): Config dict for bbox coder.
      reg_decoded_bbox (bool): Whether to regress decoded bbox.             Defaults to False.
      train_cfg (dict): Training config of SABLRetinaHead.
      test_cfg (dict): Testing config of SABLRetinaHead.
      loss_cls (dict): Config of classification loss.
      loss_bbox_cls (dict): Config of classification loss for bbox branch.
      loss_bbox_reg (dict): Config of regression loss for bbox branch.
code: def loss_single(
      self,
      cls_score,
      bbox_pred,
      labels,
      label_weights,
      bbox_cls_targets,
      bbox_cls_weights,
      bbox_reg_targets,
      bbox_reg_weights,
      num_total_samples,
  ):
      # classification loss
      labels = labels.reshape(-1)
      label_weights = label_weights.reshape(-1)
      cls_score = cls_score.permute(0, 2, 3, 1).reshape(
          -1, self.cls_out_channels
      )
      loss_cls = self.loss_cls(
          cls_score, labels, label_weights, avg_factor=num_total_samples
      )
      # regression loss
      bbox_cls_targets = bbox_cls_targets.reshape(-1, self.side_num * 4)
      bbox_cls_weights = bbox_cls_weights.reshape(-1, self.side_num * 4)
      bbox_reg_targets = bbox_reg_targets.reshape(-1, self.side_num * 4)
      bbox_reg_weights = bbox_reg_weights.reshape(-1, self.side_num * 4)
      (bbox_cls_pred, bbox_reg_pred) = bbox_pred
      bbox_cls_pred = bbox_cls_pred.permute(0, 2, 3, 1).reshape(
          -1, self.side_num * 4
      )
      bbox_reg_pred = bbox_reg_pred.permute(0, 2, 3, 1).reshape(
          -1, self.side_num * 4
      )
      loss_bbox_cls = self.loss_bbox_cls(
          bbox_cls_pred,
          bbox_cls_targets.long(),
          bbox_cls_weights,
          avg_factor=num_total_samples * 4 * self.side_num,
      )
      loss_bbox_reg = self.loss_bbox_reg(
          bbox_reg_pred,
          bbox_reg_targets,
          bbox_reg_weights,
          avg_factor=num_total_samples
          * 4
          * self.bbox_coder.offset_topk,
      )
      return loss_cls, loss_bbox_cls, loss_bbox_reg
  
imports: import numpy
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, images_to_levels, multi_apply, multiclass_nms, unmap
  from ..builder import HEADS, build_loss
  from .base_dense_head import BaseDenseHead
  from .guided_anchor_head import GuidedAnchorHead
label_desc: Use image node_id 9 for calling the SABLRetinaHead obj's underlying member method code with example usage: obj.loss_single(cls_score, bbox_pred, labels, label_weights, bbox_cls_targets, bbox_cls_weights, bbox_reg_targets, bbox_reg_weights, num_total_samples) and returns: loss_cls,  loss_bbox_cls,  loss_bbox_reg