class_docstr: Anchor-based head (RPN, RetinaNet, SSD, etc.).
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      feat_channels (int): Number of hidden channels. Used in child classes.
      anchor_generator (dict): Config dict for anchor generator
      bbox_coder (dict): Config of bounding box coder.
      reg_decoded_bbox (bool): If true, the regression loss would be
          applied on decoded bounding boxes. Default: False
      loss_cls (dict): Config of classification loss.
      loss_bbox (dict): Config of localization loss.
      train_cfg (dict): Training config of anchor head.
      test_cfg (dict): Testing config of anchor head.
docstr: Get anchors according to feature map sizes.
  
  Args:
      featmap_sizes (list[tuple]): Multi-level feature map sizes.
      img_metas (list[dict]): Image meta info.
      device (torch.device | str): Device for returned tensors
  
  Returns:
      tuple:
          anchor_list (list[Tensor]): Anchors of each image.
          valid_flag_list (list[Tensor]): Valid flags of each image.
docstr_tok: ["Get","anchors","according","to","feature","map","sizes",".","Args",":","featmap_sizes","(","list","[","tuple","]",")",":","Multi-level","feature","map","sizes",".","img_metas","(","list","[","dict","]",")",":","Image","meta","info",".","device","(","torch.device","|","str",")",":","Device","for","returned","tensors","Returns",":","tuple",":","anchor_list","(","list","[","Tensor","]",")",":","Anchors","of","each","image",".","valid_flag_list","(","list","[","Tensor","]",")",":","Valid","flags","of","each","image","."]
code: def get_anchors(self, featmap_sizes, img_metas, device="cuda"):
      """Get anchors according to feature map sizes.
  
      Args:
          featmap_sizes (list[tuple]): Multi-level feature map sizes.
          img_metas (list[dict]): Image meta info.
          device (torch.device | str): Device for returned tensors
  
      Returns:
          tuple:
              anchor_list (list[Tensor]): Anchors of each image.
              valid_flag_list (list[Tensor]): Valid flags of each image.
      """
      num_imgs = len(img_metas)
  
      # since feature map sizes of all images are the same, we only compute
      # anchors for one time
      multi_level_anchors = self.anchor_generator.grid_anchors(
          featmap_sizes, device
      )
      anchor_list = [multi_level_anchors for _ in range(num_imgs)]
  
      # for each image, we compute valid flags of multi level anchors
      valid_flag_list = []
      for img_id, img_meta in enumerate(img_metas):
          multi_level_flags = self.anchor_generator.valid_flags(
              featmap_sizes, img_meta["pad_shape"], device
          )
          valid_flag_list.append(multi_level_flags)
  
      return anchor_list, valid_flag_list
  
imports: import torch
  import torch.nn
  from mmcv.cnn import normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import anchor_inside_flags, 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 .dense_test_mixins import BBoxTestMixin
label_desc: Use image node_id 6 for calling the AnchorHead obj's underlying member method code with example usage: obj.get_anchors(featmap_sizes, img_metas, device) and returns: anchor_list,  valid_flag_list