code: def get_coord_features(
      self, points, batchsize, rows, cols, layers
  ):  # [B, num_points*2, 4]
      if self.cpu_mode:
          coords = []
          for i in range(batchsize):
              norm_delimeter = (
                  1.0
                  if self.use_disks
                  else self.spatial_scale * self.norm_radius
              )
              coords.append(
                  self._get_dist_maps(
                      points[i].numpy().astype("float32"),
                      rows,
                      cols,
                      norm_delimeter,
                  )
              )
          coords = paddle.to_tensor(np.stack(coords, axis=0)).astype(
              "float32"
          )
      else:
          num_points = points.shape[1] // 2  # [1, 2, 4]
          points = points.reshape(
              [-1, paddle.shape(points)[2]]
          )  # [B*num_points*2, 4]
          points, points_order = paddle.split(
              points, [3, 1], axis=1
          )  # [2, 3]
          # [B*num_points*2, 3],  [B*num_points*2, 1]
          invalid_points = paddle.max(points, axis=1, keepdim=False) < 0
          row_array = paddle.arange(
              start=0, end=rows, step=1, dtype="float32"
          )
          col_array = paddle.arange(
              start=0, end=cols, step=1, dtype="float32"
          )
          layer_array = paddle.arange(
              start=0, end=layers, step=1, dtype="float32"
          )
  
          coord_rows, coord_cols, coor_layers = paddle.meshgrid(
              row_array, col_array, layer_array  # [512, 512, 12]
          )  # len is 3 [rows, cols, layers]
          coords = paddle.unsqueeze(
              paddle.stack(
                  [coord_rows, coord_cols, coor_layers], axis=0
              ),
              axis=0,
          ).tile(  # [B*num_points*2, 3, rows, cols, layers]
              [paddle.shape(points)[0], 1, 1, 1, 1]
          )  # [B*num_points*2 | 768, 3, 512, 512, 12] # repeat
  
          add_xy = (points * self.spatial_scale).reshape(
              [points.shape[0], points.shape[1], 1, 1, 1]
          )
          # [B*num_points*2, 3, 1, 1, 1]
          # 所有的坐标组合，减去point的数值，只有point对应位置为0，其他相近的也小 [B*num_points*2, 3, rows, cols, layers]
          coords = coords - add_xy  # [B*num_points*2, 3, 512, 512, 12]
  
          if not self.use_disks:
              coords = coords / (self.norm_radius * self.spatial_scale)
  
          coords = (
              coords * coords
          )  # [B*num_points*2, 3, 512, 512, 12] 取平方
          coords[:, 0] += coords[:, 1] + coords[:, 2]
          coords = coords[
              :, :1
          ]  # [B*num_points*2, 1, rows, cols, layers]
  
          # [B*2, num_points, 1, rows, cols, layers]
          coords = coords.reshape(
              [-1, num_points, 1, rows, cols, layers]
          )
          # [B*2, 1, 512, 512, 12] 所有point中最小的
          coords = paddle.min(coords, axis=1)
          coords = coords.reshape([-1, 2, rows, cols, layers])
          #  [B, 2, rows, cols, layers] [B, 2, 512, 512, 12]
  
      if self.use_disks:
          coords = (
              coords <= (self.norm_radius * self.spatial_scale) ** 2
          ).astype(
              "float32"
          )  # 只取较小的数值对应的特征
      else:
          coords = paddle.tanh(paddle.sqrt(coords) * 2)
  
      return coords
  
imports: import paddle
  import paddle.nn
  import numpy
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling the DistMaps3D obj's underlying member method code with example usage: obj.get_coord_features(points, batchsize, rows, cols, layers) and returns: coords