class_docstr: Anchor generator for YOLO.
  
  Args:
      strides (list[int] | list[tuple[int, int]]): Strides of anchors
          in multiple feature levels.
      base_sizes (list[list[tuple[int, int]]]): The basic sizes
          of anchors in multiple levels.
docstr: Generate the responsible flags of anchor in a single feature map.
  
  Args:
      featmap_size (tuple[int]): The size of feature maps.
      gt_bboxes (Tensor): Ground truth boxes, shape (n, 4).
      stride (tuple(int)): stride of current level
      num_base_anchors (int): The number of base anchors.
      device (str, optional): Device where the flags will be put on.
          Defaults to 'cuda'.
  
  Returns:
      torch.Tensor: The valid flags of each anchor in a single level                 feature map.
code: def single_level_responsible_flags(
      self,
      featmap_size,
      gt_bboxes,
      stride,
      num_base_anchors,
      device="cuda",
  ):
      """Generate the responsible flags of anchor in a single feature map.
  
          Args:
              featmap_size (tuple[int]): The size of feature maps.
              gt_bboxes (Tensor): Ground truth boxes, shape (n, 4).
              stride (tuple(int)): stride of current level
              num_base_anchors (int): The number of base anchors.
              device (str, optional): Device where the flags will be put on.
                  Defaults to 'cuda'.
  
          Returns:
              torch.Tensor: The valid flags of each anchor in a single level \
                  feature map.
          """
      feat_h, feat_w = featmap_size
      gt_bboxes_cx = ((gt_bboxes[:, 0] + gt_bboxes[:, 2]) * 0.5).to(
          device
      )
      gt_bboxes_cy = ((gt_bboxes[:, 1] + gt_bboxes[:, 3]) * 0.5).to(
          device
      )
      gt_bboxes_grid_x = torch.floor(gt_bboxes_cx / stride[0]).long()
      gt_bboxes_grid_y = torch.floor(gt_bboxes_cy / stride[1]).long()
  
      # row major indexing
      gt_bboxes_grid_idx = gt_bboxes_grid_y * feat_w + gt_bboxes_grid_x
  
      responsible_grid = torch.zeros(
          feat_h * feat_w, dtype=torch.uint8, device=device
      )
      responsible_grid[gt_bboxes_grid_idx] = 1
  
      responsible_grid = (
          responsible_grid[:, None]
          .expand(responsible_grid.size(0), num_base_anchors)
          .contiguous()
          .view(-1)
      )
      return responsible_grid
  
imports: import mmcv
  import numpy
  import torch
  from torch.nn.modules.utils import _pair
  from .builder import ANCHOR_GENERATORS
label_desc: Use image node_id 6 for calling the YOLOAnchorGenerator obj's underlying member method code with example usage: obj.single_level_responsible_flags(featmap_size, gt_bboxes, stride, num_base_anchors, device) and returns: responsible_grid