code: def benchmark_rotated_iou():
      num_boxes1 = 200
      num_boxes2 = 500
      boxes1 = torch.stack(
          [
              torch.tensor(
                  [5 + 20 * i, 5 + 20 * i, 10, 10, 0],
                  dtype=torch.float32,
              )
              for i in range(num_boxes1)
          ]
      )
      boxes2 = torch.stack(
          [
              torch.tensor(
                  [
                      5 + 20 * i,
                      5 + 20 * i,
                      10,
                      1 + 9 * i / num_boxes2,
                      0,
                  ],
                  dtype=torch.float32,
              )
              for i in range(num_boxes2)
          ]
      )
  
      def func(dev, n=1):
          b1 = boxes1.to(device=dev)
          b2 = boxes2.to(device=dev)
  
          def bench():
              for _ in range(n):
                  pairwise_iou_rotated(b1, b2)
              if dev.type == "cuda":
                  torch.cuda.synchronize()
  
          return bench
  
      # only run it once per timed loop, since it's slow
      args = [{"dev": torch.device("cpu"), "n": 1}]
      if torch.cuda.is_available():
          args.append({"dev": torch.device("cuda"), "n": 10})
  
      benchmark(func, "rotated_iou", args, warmup_iters=3)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import math
  import random
  import unittest
  import torch
  from fvcore.common.benchmark import benchmark
  from detectron2.layers.rotated_boxes import pairwise_iou_rotated
  from detectron2.structures.boxes import Boxes
  from detectron2.structures.rotated_boxes import RotatedBoxes, pairwise_iou
  from detectron2.utils.testing import reload_script_model
label_desc: Use image node_id 1 for calling a global function with example usage: benchmark_rotated_iou() and returns: bench