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.
docstr: Get squares according to feature map sizes and guided anchors.
  
  Args:
      featmap_sizes (list[tuple]): Multi-level feature map sizes.
      shape_preds (list[tensor]): Multi-level shape predictions.
      loc_preds (list[tensor]): Multi-level location predictions.
      img_metas (list[dict]): Image meta info.
      use_loc_filter (bool): Use loc filter or not.
      device (torch.device | str): device for returned tensors
  
  Returns:
      tuple: square approxs of each image, guided anchors of each image,
          loc masks of each image
docstr_tok: ["Get","squares","according","to","feature","map","sizes","and","guided","anchors",".","Args",":","featmap_sizes","(","list","[","tuple","]",")",":","Multi-level","feature","map","sizes",".","shape_preds","(","list","[","tensor","]",")",":","Multi-level","shape","predictions",".","loc_preds","(","list","[","tensor","]",")",":","Multi-level","location","predictions",".","img_metas","(","list","[","dict","]",")",":","Image","meta","info",".","use_loc_filter","(","bool",")",":","Use","loc","filter","or","not",".","device","(","torch.device","|","str",")",":","device","for","returned","tensors","Returns",":","tuple",":","square","approxs","of","each","image",",","guided","anchors","of","each","image",",","loc","masks","of","each","image"]
code: def get_anchors(
      self,
      featmap_sizes,
      shape_preds,
      loc_preds,
      img_metas,
      use_loc_filter=False,
      device="cuda",
  ):
      """Get squares according to feature map sizes and guided anchors.
  
      Args:
          featmap_sizes (list[tuple]): Multi-level feature map sizes.
          shape_preds (list[tensor]): Multi-level shape predictions.
          loc_preds (list[tensor]): Multi-level location predictions.
          img_metas (list[dict]): Image meta info.
          use_loc_filter (bool): Use loc filter or not.
          device (torch.device | str): device for returned tensors
  
      Returns:
          tuple: square approxs of each image, guided anchors of each image,
              loc masks of each image
      """
      num_imgs = len(img_metas)
      num_levels = len(featmap_sizes)
  
      # since feature map sizes of all images are the same, we only compute
      # squares for one time
      multi_level_squares = self.square_anchor_generator.grid_anchors(
          featmap_sizes, device=device
      )
      squares_list = [multi_level_squares for _ in range(num_imgs)]
  
      # for each image, we compute multi level guided anchors
      guided_anchors_list = []
      loc_mask_list = []
      for img_id, img_meta in enumerate(img_metas):
          multi_level_guided_anchors = []
          multi_level_loc_mask = []
          for i in range(num_levels):
              squares = squares_list[img_id][i]
              shape_pred = shape_preds[i][img_id]
              loc_pred = loc_preds[i][img_id]
              (
                  guided_anchors,
                  loc_mask,
              ) = self._get_guided_anchors_single(
                  squares,
                  shape_pred,
                  loc_pred,
                  use_loc_filter=use_loc_filter,
              )
              multi_level_guided_anchors.append(guided_anchors)
              multi_level_loc_mask.append(loc_mask)
          guided_anchors_list.append(multi_level_guided_anchors)
          loc_mask_list.append(multi_level_loc_mask)
      return squares_list, guided_anchors_list, loc_mask_list
  
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 7 for calling the GuidedAnchorHead obj's underlying member method code with example usage: obj.get_anchors(featmap_sizes, shape_preds, loc_preds, img_metas, use_loc_filter, device) and returns: squares_list,  guided_anchors_list,  loc_mask_list