class_docstr: This code is based on
  https://github.com/fcjian/TOOD/blob/master/mmdet/models/dense_heads/tood_head.py
class_docstr_tok: ["This","code","is","based","on","https",":","\/\/github.com\/fcjian\/TOOD\/blob\/master\/mmdet\/models\/dense_heads\/tood_head.py"]
code: def _reg_grid_sample(self, feat, offset, anchor_points):
      feat_shape = get_static_shape(feat)
      b = feat_shape[0:1]
      h = feat_shape[2:3]
      w = feat_shape[3:4]
      feat = paddle.reshape(feat, [-1, 1, h, w])
      offset = paddle.reshape(offset, [-1, 2, h, w]).transpose(
          [0, 2, 3, 1]
      )
      grid_shape = paddle.concat([w, h]).astype("float32")
      grid = (offset + anchor_points) / grid_shape
      grid = 2 * grid.clip(0.0, 1.0) - 1
      feat = F.grid_sample(feat, grid)
      feat = paddle.reshape(feat, [b, -1, h, w])
      return feat
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.nn.initializer import Constant
  from ppdet.core.workspace import register
  from ..initializer import normal_, constant_, bias_init_with_prob
  from ppdet.modeling.bbox_utils import bbox_center, batch_distance2bbox
  from ..losses import GIoULoss
  from ppdet.modeling.layers import ConvNormLayer
  from ppdet.modeling.ops import get_static_shape
  from ppdet.modeling.assigners.utils import generate_anchors_for_grid_cell
label_desc: Use image node_id 4 for calling the TOODHead obj's underlying member method code with example usage: obj._reg_grid_sample(feat, offset, anchor_points) and returns: feat