class_docstr: AnchorGenerator by paddle
class_docstr_tok: ["AnchorGenerator","by","paddle"]
code: def forward(self, featmap_size, stride=16):
      # featmap_size*stride project it to original area
  
      feat_h = featmap_size[0]
      feat_w = featmap_size[1]
      shift_x = paddle.arange(0, feat_w, 1, "int32") * stride
      shift_y = paddle.arange(0, feat_h, 1, "int32") * stride
      shift_xx, shift_yy = self._meshgrid(shift_x, shift_y)
      shifts = paddle.stack(
          [shift_xx, shift_yy, shift_xx, shift_yy], axis=-1
      )
  
      all_anchors = self.base_anchors[:, :] + shifts[:, :]
      all_anchors = all_anchors.cast(paddle.float32).reshape(
          [feat_h * feat_w, 4]
      )
      all_anchors = self.rect2rbox(all_anchors)
      return all_anchors
  
imports: import math
  import paddle
  import paddle.nn
  import numpy
  from ppdet.core.workspace import register
label_desc: Use image node_id 5 for calling the S2ANetAnchorGenerator obj's underlying member method code with example usage: obj.forward(featmap_size, stride) and returns: all_anchors