code: def get_reference_points(spatial_shapes, valid_ratios, offset=0.5):
      valid_ratios = valid_ratios.unsqueeze(1)
      reference_points = []
      for i, (H, W) in enumerate(spatial_shapes):
          ref_y, ref_x = paddle.meshgrid(
              paddle.arange(end=H) + offset,
              paddle.arange(end=W) + offset,
          )
          ref_y = ref_y.flatten().unsqueeze(0) / (
              valid_ratios[:, :, i, 1] * H
          )
          ref_x = ref_x.flatten().unsqueeze(0) / (
              valid_ratios[:, :, i, 0] * W
          )
          reference_points.append(paddle.stack((ref_x, ref_y), axis=-1))
      reference_points = paddle.concat(reference_points, 1).unsqueeze(2)
      reference_points = reference_points * valid_ratios
      return reference_points
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from ppdet.core.workspace import register
  from ..layers import MultiHeadAttention
  from .position_encoding import PositionEmbedding
  from .utils import _get_clones, get_valid_ratio
  from ..initializer import linear_init_, constant_, xavier_uniform_, normal_
label_desc: Use image node_id 2 for calling the DeformableTransformerEncoder obj's underlying member method code with example usage: obj.get_reference_points(spatial_shapes, valid_ratios, offset) and returns: reference_points