code: def forward(self, image_list, feature_maps):
      # type: (ImageList, List[Tensor]) -> List[Tensor]
      # 获取每个预测特征层的尺寸(height, width)
      grid_sizes = list(
          [feature_map.shape[-2:] for feature_map in feature_maps]
      )
  
      # 获取输入图像的height和width
      image_size = image_list.tensors.shape[-2:]
  
      # 获取变量类型和设备类型
      dtype, device = feature_maps[0].dtype, feature_maps[0].device
  
      # one step in feature map equate n pixel stride in origin image
      # 计算特征层上的一步等于原始图像上的步长
      strides = [
          [
              torch.tensor(
                  image_size[0] // g[0],
                  dtype=torch.int64,
                  device=device,
              ),
              torch.tensor(
                  image_size[1] // g[1],
                  dtype=torch.int64,
                  device=device,
              ),
          ]
          for g in grid_sizes
      ]
  
      # 根据提供的sizes和aspect_ratios生成anchors模板
      self.set_cell_anchors(dtype, device)
  
      # 计算/读取所有anchors的坐标信息（这里的anchors信息是映射到原图上的所有anchors信息，不是anchors模板）
      # 得到的是一个list列表，对应每张预测特征图映射回原图的anchors坐标信息
      anchors_over_all_feature_maps = self.cached_grid_anchors(
          grid_sizes, strides
      )
  
      anchors = torch.jit.annotate(List[List[torch.Tensor]], [])
      # 遍历一个batch中的每张图像
      for i, (image_height, image_width) in enumerate(
          image_list.image_sizes
      ):
          anchors_in_image = []
          # 遍历每张预测特征图映射回原图的anchors坐标信息
          for anchors_per_feature_map in anchors_over_all_feature_maps:
              anchors_in_image.append(anchors_per_feature_map)
          anchors.append(anchors_in_image)
      # 将每一张图像的所有预测特征层的anchors坐标信息拼接在一起
      # anchors是个list，每个元素为一张图像的所有anchors信息
      anchors = [
          torch.cat(anchors_per_image) for anchors_per_image in anchors
      ]
      # Clear the cache in case that memory leaks.
      self._cache.clear()
      return anchors
  
imports: from typing import List, Optional, Dict, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  import torchvision
  from .None import det_utils
  from .None import boxes
  from .image_list import ImageList
label_desc: Use image node_id 7 for calling the AnchorsGenerator obj's underlying member method code with example usage: obj.forward(image_list, feature_maps) and returns: anchors