code: def assign_boxes_to_levels(
      box_lists: List[Boxes],
      min_level: int,
      max_level: int,
      canonical_box_size: int,
      canonical_level: int,
  ):
      """
      Map each box in `box_lists` to a feature map level index and return the assignment
      vector.
  
      Args:
          box_lists (list[Boxes] | list[RotatedBoxes]): A list of N Boxes or N RotatedBoxes,
              where N is the number of images in the batch.
          min_level (int): Smallest feature map level index. The input is considered index 0,
              the output of stage 1 is index 1, and so.
          max_level (int): Largest feature map level index.
          canonical_box_size (int): A canonical box size in pixels (sqrt(box area)).
          canonical_level (int): The feature map level index on which a canonically-sized box
              should be placed.
  
      Returns:
          A tensor of length M, where M is the total number of boxes aggregated over all
              N batch images. The memory layout corresponds to the concatenation of boxes
              from all images. Each element is the feature map index, as an offset from
              `self.min_level`, for the corresponding box (so value i means the box is at
              `self.min_level + i`).
      """
      box_sizes = torch.sqrt(cat([boxes.area() for boxes in box_lists]))
      # Eqn.(1) in FPN paper
      level_assignments = torch.floor(
          canonical_level
          + torch.log2(box_sizes / canonical_box_size + 1e-8)
      )
      # clamp level to (min, max), in case the box size is too large or too small
      # for the available feature maps
      level_assignments = torch.clamp(
          level_assignments, min=min_level, max=max_level
      )
      return level_assignments.to(torch.int64) - min_level
  
file_path: detectron2/detectron2/modeling/poolers.py
imports: import math
  from typing import List, Optional
  import torch
  from torch import nn
  from torchvision.ops import RoIPool
  from detectron2.layers import ROIAlign, ROIAlignRotated, cat, nonzero_tuple, shapes_to_tensor
  from detectron2.structures import Boxes
  from detectron2.utils.tracing import assert_fx_safe, is_fx_tracing
label_desc: Use image node_id 1 for calling a global function with example usage: assign_boxes_to_levels(box_lists, min_level, max_level, canonical_box_size, canonical_level) and returns: unknown