class_docstr: Guided-Anchor-based head (GA-RPN, GA-RetinaNet, etc.).
  
  This GuidedAnchorHead will predict high-quality feature guided
  anchors and locations where anchors will be kept in inference.
  There are mainly 3 categories of bounding-boxes.
  
  - Sampled 9 pairs for target assignment. (approxes)
  - The square boxes where the predicted anchors are based on. (squares)
  - Guided anchors.
  
  Please refer to https://arxiv.org/abs/1901.03278 for more details.
  
  Args:
      num_classes (int): Number of classes.
      in_channels (int): Number of channels in the input feature map.
      feat_channels (int): Number of hidden channels.
      approx_anchor_generator (dict): Config dict for approx generator
      square_anchor_generator (dict): Config dict for square generator
      anchor_coder (dict): Config dict for anchor coder
      bbox_coder (dict): Config dict for bbox coder
      deform_groups: (int): Group number of DCN in
          FeatureAdaption module.
      loc_filter_thr (float): Threshold to filter out unconcerned regions.
      loss_loc (dict): Config of location loss.
      loss_shape (dict): Config of anchor shape loss.
      loss_cls (dict): Config of classification loss.
      loss_bbox (dict): Config of bbox regression loss.
code: def loss_shape_single(
      self,
      shape_pred,
      bbox_anchors,
      bbox_gts,
      anchor_weights,
      anchor_total_num,
  ):
      shape_pred = (
          shape_pred.permute(0, 2, 3, 1).contiguous().view(-1, 2)
      )
      bbox_anchors = bbox_anchors.contiguous().view(-1, 4)
      bbox_gts = bbox_gts.contiguous().view(-1, 4)
      anchor_weights = anchor_weights.contiguous().view(-1, 4)
      bbox_deltas = bbox_anchors.new_full(bbox_anchors.size(), 0)
      bbox_deltas[:, 2:] += shape_pred
      # filter out negative samples to speed-up weighted_bounded_iou_loss
      inds = torch.nonzero(
          anchor_weights[:, 0] > 0, as_tuple=False
      ).squeeze(1)
      bbox_deltas_ = bbox_deltas[inds]
      bbox_anchors_ = bbox_anchors[inds]
      bbox_gts_ = bbox_gts[inds]
      anchor_weights_ = anchor_weights[inds]
      pred_anchors_ = self.anchor_coder.decode(
          bbox_anchors_, bbox_deltas_, wh_ratio_clip=1e-6
      )
      loss_shape = self.loss_shape(
          pred_anchors_,
          bbox_gts_,
          anchor_weights_,
          avg_factor=anchor_total_num,
      )
      return loss_shape
  
imports: import torch
  import torch.nn
  from mmcv.cnn import bias_init_with_prob, normal_init
  from mmcv.ops import DeformConv2d, MaskedConv2d
  from mmcv.runner import force_fp32
  from mmdet.core import anchor_inside_flags, build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, calc_region, images_to_levels, multi_apply, multiclass_nms, unmap
  from ..builder import HEADS, build_loss
  from .anchor_head import AnchorHead
label_desc: Use image node_id 12 for calling the GuidedAnchorHead obj's underlying member method code with example usage: obj.loss_shape_single(shape_pred, bbox_anchors, bbox_gts, anchor_weights, anchor_total_num) and returns: loss_shape