code: def test_anchor_generator_with_tuples():
      from mmdet.models.task_modules import build_anchor_generator
  
      if torch.cuda.is_available():
          device = "cuda"
      else:
          device = "cpu"
  
      anchor_generator_cfg = dict(
          type="SSDAnchorGenerator",
          scale_major=False,
          input_size=300,
          basesize_ratio_range=(0.15, 0.9),
          strides=[8, 16, 32, 64, 100, 300],
          ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]],
      )
  
      featmap_sizes = [
          (38, 38),
          (19, 19),
          (10, 10),
          (5, 5),
          (3, 3),
          (1, 1),
      ]
      anchor_generator = build_anchor_generator(anchor_generator_cfg)
      anchors = anchor_generator.grid_anchors(featmap_sizes, device)
  
      anchor_generator_cfg_tuples = dict(
          type="SSDAnchorGenerator",
          scale_major=False,
          input_size=300,
          basesize_ratio_range=(0.15, 0.9),
          strides=[
              (8, 8),
              (16, 16),
              (32, 32),
              (64, 64),
              (100, 100),
              (300, 300),
          ],
          ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]],
      )
  
      anchor_generator_tuples = build_anchor_generator(
          anchor_generator_cfg_tuples
      )
      anchors_tuples = anchor_generator_tuples.grid_anchors(
          featmap_sizes, device
      )
      for anchor, anchor_tuples in zip(anchors, anchors_tuples):
          assert torch.equal(anchor, anchor_tuples)
  
file_path: mmdetection/tests/test_models/test_task_modules/test_prior_generators/test_anchor_generator.py
imports: import pytest
  import torch
label_desc: Use image node_id 6 for calling a global function with example usage: test_anchor_generator_with_tuples() without return types