docstr: Generate valid flags of anchors in a feature map.
  
  Args:
      featmap_sizes (list(tuple[int, int])): List of feature map sizes in
          multiple feature levels.
      valid_shape (tuple[int, int]): The valid shape of the image.
      device (str | torch.device): Device where the anchors will be
          put on.
  
  Return:
      torch.Tensor: Valid flags of anchors in a level.
docstr_tok: ["Generate","valid","flags","of","anchors","in","a","feature","map",".","Args",":","featmap_sizes","(","list","(","tuple","[","int",",","int","]",")",")",":","List","of","feature","map","sizes","in","multiple","feature","levels",".","valid_shape","(","tuple","[","int",",","int","]",")",":","The","valid","shape","of","the","image",".","device","(","str","|","torch.device",")",":","Device","where","the","anchors","will","be","put","on",".","Return",":","torch.Tensor",":","Valid","flags","of","anchors","in","a","level","."]
code: def valid_flags(
      self,
      featmap_size: Tuple[int, int],
      valid_size: Tuple[int, int],
      device: DeviceType = "cuda",
  ) -> Tensor:
      """Generate valid flags of anchors in a feature map.
  
      Args:
          featmap_sizes (list(tuple[int, int])): List of feature map sizes in
              multiple feature levels.
          valid_shape (tuple[int, int]): The valid shape of the image.
          device (str | torch.device): Device where the anchors will be
              put on.
  
      Return:
          torch.Tensor: Valid flags of anchors in a level.
      """
      feat_h, feat_w = featmap_size
      valid_h, valid_w = valid_size
      assert valid_h <= feat_h and valid_w <= feat_w
      valid_x = torch.zeros(feat_w, dtype=torch.bool, device=device)
      valid_y = torch.zeros(feat_h, dtype=torch.bool, device=device)
      valid_x[:valid_w] = 1
      valid_y[:valid_h] = 1
      valid_xx, valid_yy = self._meshgrid(valid_x, valid_y)
      valid = valid_xx & valid_yy
      return valid
  
file_path: mmdetection/mmdet/models/task_modules/prior_generators/point_generator.py
imports: from typing import List, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from torch.nn.modules.utils import _pair
  from mmdet.registry import TASK_UTILS
label_desc: Use image node_id 3 for calling the PointGenerator obj's underlying member method code with example usage: obj.valid_flags(featmap_size, valid_size, device) and returns: valid