class_docstr: FCOSR Head, refer to https://arxiv.org/abs/2111.10780 for details 
class_docstr_tok: ["FCOSR","Head",",","refer","to","https",":","\/\/arxiv.org\/abs\/2111.10780","for","details"]
code: def _generate_anchors(self, feats):
      if self.trt:
          anchor_points = []
          for feat, stride in zip(feats, self.fpn_strides):
              _, _, h, w = paddle.shape(feat)
              anchor, _ = anchor_generator(
                  feat,
                  stride * 4,
                  1.0,
                  [1.0, 1.0, 1.0, 1.0],
                  [stride, stride],
                  offset=0.5,
              )
              x1, y1, x2, y2 = paddle.split(anchor, 4, axis=-1)
              xc = (x1 + x2 + 1) / 2
              yc = (y1 + y2 + 1) / 2
              anchor_point = paddle.concat([xc, yc], axis=-1).reshape(
                  (1, h * w, 2)
              )
              anchor_points.append(anchor_point)
          anchor_points = paddle.concat(anchor_points, axis=1)
          return anchor_points, None, None
      else:
          anchor_points = []
          stride_tensor = []
          num_anchors_list = []
          for feat, stride in zip(feats, self.fpn_strides):
              _, _, h, w = paddle.shape(feat)
              shift_x = (paddle.arange(end=w) + 0.5) * stride
              shift_y = (paddle.arange(end=h) + 0.5) * stride
              shift_y, shift_x = paddle.meshgrid(shift_y, shift_x)
              anchor_point = paddle.cast(
                  paddle.stack([shift_x, shift_y], axis=-1),
                  dtype="float32",
              )
              anchor_points.append(anchor_point.reshape([1, -1, 2]))
              stride_tensor.append(
                  paddle.full([1, h * w, 1], stride, dtype="float32")
              )
              num_anchors_list.append(h * w)
          anchor_points = paddle.concat(anchor_points, axis=1)
          stride_tensor = paddle.concat(stride_tensor, axis=1)
          return anchor_points, stride_tensor, num_anchors_list
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from .fcos_head import ScaleReg
  from ..initializer import bias_init_with_prob, constant_, normal_
  from ..ops import get_act_fn, anchor_generator
  from ..rbox_utils import box2corners
  from ..losses import ProbIoULoss
  import numpy
label_desc: Use image node_id 4 for calling the FCOSRHead obj's underlying member method code with example usage: obj._generate_anchors(feats) and returns: anchor_points,  None,  None, anchor_points,  stride_tensor,  num_anchors_list