class_docstr: Anchor generator for Region Proposal Networks.
  
  Parameters
  ----------
  stride : int
      Feature map stride with respect to original image.
      This is usually the ratio between original image size and feature map size.
  base_size : int
      The width(and height) of reference anchor box.
  ratios : iterable of float
      The aspect ratios of anchor boxes. We expect it to be a list or tuple.
  scales : iterable of float
      The areas of anchor boxes.
      We use the following form to compute the shapes of anchors:
  
      .. math::
  
          width_{anchor} = size_{base} \times scale \times \sqrt{ 1 / ratio}
          height_{anchor} = size_{base} \times scale \times \sqrt{ratio}
  
  alloc_size : tuple of int
      Allocate size for the anchor boxes as (H, W).
      Usually we generate enough anchors for large feature map, e.g. 128x128.
      Later in inference we can have variable input sizes,
      at which time we can crop corresponding anchors from this large
      anchor map so we can skip re-generating anchors for each input.
code: def __init__(
      self, stride, base_size, ratios, scales, alloc_size, **kwargs
  ):
      super(RPNAnchorGenerator, self).__init__(**kwargs)
      if not base_size:
          raise ValueError("Invalid base_size: {}.".format(base_size))
      if not isinstance(ratios, (tuple, list)):
          ratios = [ratios]
      if not isinstance(scales, (tuple, list)):
          scales = [scales]
  
      anchors = self._generate_anchors(
          stride, base_size, ratios, scales, alloc_size
      )
      self._num_depth = len(ratios) * len(scales)
      self.anchors = self.params.get_constant("anchor_", anchors)
  
file_path: gluon-cv/gluoncv/model_zoo/rcnn/rpn/anchor.py
imports: from __future__ import absolute_import
  import numpy
  from mxnet import gluon
label_desc: Use image node_id 1 to create a new RPNAnchorGenerator object from inherited base classes: gluon with example: obj = RPNAnchorGenerator(stride, base_size, ratios, scales, alloc_size)