code: def anchor_ctr_inside_region_flags(
      anchors: Tensor, stride: int, region: Tuple[Tensor]
  ) -> Tensor:
      """Get the flag indicate whether anchor centers are inside regions."""
      x1, y1, x2, y2 = region
      f_anchors = anchors / stride
      x = (f_anchors[:, 0] + f_anchors[:, 2]) * 0.5
      y = (f_anchors[:, 1] + f_anchors[:, 3]) * 0.5
      flags = (x >= x1) & (x <= x2) & (y >= y1) & (y <= y2)
      return flags
  
file_path: mmdetection/mmdet/models/task_modules/assigners/region_assigner.py
imports: from typing import List, Optional, Tuple
  import torch
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from ..prior_generators import anchor_inside_flags
  from .assign_result import AssignResult
  from .base_assigner import BaseAssigner
label_desc: Use image node_id 2 for calling a global function with example usage: anchor_ctr_inside_region_flags(anchors, stride, region) and returns: flags