docstr: Generate base anchors of a single level.
  
  Args:
      base_size (int | float): Basic size of an anchor.
      scales (torch.Tensor): Scales of the anchor.
      ratios (torch.Tensor): The ratio between the height
          and width of anchors in a single level.
      center (tuple[float], optional): The center of the base anchor
          related to a single feature grid. Defaults to None.
  
  Returns:
      torch.Tensor: Anchors in a single-level feature maps.
docstr_tok: ["Generate","base","anchors","of","a","single","level",".","Args",":","base_size","(","int","|","float",")",":","Basic","size","of","an","anchor",".","scales","(","torch.Tensor",")",":","Scales","of","the","anchor",".","ratios","(","torch.Tensor",")",":","The","ratio","between","the","height","and","width","of","anchors","in","a","single","level",".","center","(","tuple","[","float","]",",","optional",")",":","The","center","of","the","base","anchor","related","to","a","single","feature","grid",".","Defaults","to","None",".","Returns",":","torch.Tensor",":","Anchors","in","a","single-level","feature","maps","."]
code: def gen_single_level_base_anchors(
      self,
      base_size: Union[int, float],
      scales: Tensor,
      ratios: Tensor,
      center: Optional[Tuple[float]] = None,
  ) -> Tensor:
      """Generate base anchors of a single level.
  
      Args:
          base_size (int | float): Basic size of an anchor.
          scales (torch.Tensor): Scales of the anchor.
          ratios (torch.Tensor): The ratio between the height
              and width of anchors in a single level.
          center (tuple[float], optional): The center of the base anchor
              related to a single feature grid. Defaults to None.
  
      Returns:
          torch.Tensor: Anchors in a single-level feature maps.
      """
  
      w = base_size
      h = base_size
      if center is None:
          x_center = self.center_offset * w
          y_center = self.center_offset * h
      else:
          x_center, y_center = center
  
      h_ratios = torch.sqrt(ratios)
      w_ratios = 1 / h_ratios
      if self.scale_major:
          ws = (w * scales[:, None] * w_ratios[None, :]).view(-1)
          hs = (h * scales[:, None] * h_ratios[None, :]).view(-1)
      else:
          ws = (w * scales[:, None] * w_ratios[None, :]).view(-1)
          hs = (h * scales[:, None] * h_ratios[None, :]).view(-1)
  
      # use float anchor and the anchor's center is aligned with the
      # pixel center
      base_anchors = [
          y_center - 0.5 * hs,
          x_center - 0.5 * ws,
          y_center + 0.5 * hs,
          x_center + 0.5 * ws,
      ]
      base_anchors = torch.stack(base_anchors, dim=-1)
  
      return base_anchors
  
file_path: mmdetection/projects/EfficientDet/efficientdet/tensorflow/anchor_generator.py
imports: from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor
  from mmdet.models.task_modules.prior_generators.anchor_generator import AnchorGenerator
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import HorizontalBoxes
label_desc: Use image node_id 1 for calling the YXYXAnchorGenerator obj's underlying member method code with example usage: obj.gen_single_level_base_anchors(base_size, scales, ratios, center) and returns: base_anchors