class_docstr: Base class for anchor generators for the task of object detection.
code: def _get_anchors(
      self,
      fm_height: int,
      fm_width: int,
      fm_output_stride: int,
      device: Optional[str] = "cpu",
      *args,
      **kwargs,
  ) -> Union[Tensor, Tuple[Tensor, ...]]:
      key = "h_{}_w_{}_os_{}".format(
          fm_height, fm_width, fm_output_stride
      )
      if key not in self.anchors_dict:
          default_anchors_ctr = self._generate_anchors(
              height=fm_height,
              width=fm_width,
              output_stride=fm_output_stride,
              device=device,
              *args,
              **kwargs,
          )
          self.anchors_dict[key] = default_anchors_ctr
          return default_anchors_ctr
      else:
          return self.anchors_dict[key]
  
file_path: ml-cvnets/cvnets/anchor_generator/base_anchor_generator.py
imports: import argparse
  from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor
label_desc: Use image node_id 5 for calling the BaseAnchorGenerator obj's underlying member method code with example usage: obj._get_anchors(fm_height, fm_width, fm_output_stride, device) and returns: default_anchors_ctr, self