code: def batch_distance2bbox(points, distance, max_shapes=None):
      """Decode distance prediction to bounding box for batch.
      Args:
          points (Tensor): [B, ..., 2], "xy" format
          distance (Tensor): [B, ..., 4], "ltrb" format
          max_shapes (Tensor): [B, 2], "h,w" format, Shape of the image.
      Returns:
          Tensor: Decoded bboxes, "x1y1x2y2" format.
      """
      lt, rb = paddle.split(distance, 2, -1)
      # while tensor add parameters, parameters should be better placed on the second place
      x1y1 = -lt + points
      x2y2 = rb + points
      out_bbox = paddle.concat([x1y1, x2y2], -1)
      if max_shapes is not None:
          max_shapes = max_shapes.flip(-1).tile([1, 2])
          delta_dim = out_bbox.ndim - max_shapes.ndim
          for _ in range(delta_dim):
              max_shapes.unsqueeze_(1)
          out_bbox = paddle.where(
              out_bbox < max_shapes, out_bbox, max_shapes
          )
          out_bbox = paddle.where(
              out_bbox > 0, out_bbox, paddle.zeros_like(out_bbox)
          )
      return out_bbox
  
imports: import math
  import paddle
  import numpy
label_desc: Use image node_id 20 for calling a global function with example usage: batch_distance2bbox(points, distance, max_shapes) and returns: out_bbox