code: def reverse_transform(pred, ori_shape, transforms, mode="nearest"):
      """recover pred to origin shape"""
      reverse_list = get_reverse_list(ori_shape, transforms)
      for item in reverse_list[::-1]:
          if item[0] == "resize":
              h, w = item[1][0], item[1][1]
              if paddle.get_device() == "cpu":
                  pred = paddle.cast(pred, "uint8")
                  pred = F.interpolate(pred, (h, w), mode=mode)
                  pred = paddle.cast(pred, "int32")
              else:
                  pred = F.interpolate(pred, (h, w), mode=mode)
          elif item[0] == "SubImgCrop":
              offset_top, offset_bottom = item[1][0], item[1][1]
              offset_left, offset_right = item[2][0], item[2][1]
              pred = F.pad(
                  pred,
                  [
                      offset_left,
                      offset_right,
                      offset_top,
                      offset_bottom,
                  ],
                  value=0,
                  mode="constant",
                  data_format="NCHW",
              )
          elif item[0] == "padding":
              h, w = item[1][0], item[1][1]
              pred = pred[:, :, 0:h, 0:w]
          else:
              raise Exception(
                  "Unexpected info '{}' in im_info".format(item[0])
              )
      return pred
  
file_path: PaddleSeg/contrib/LaneSeg/core/infer.py
imports: import collections.abc
  from itertools import combinations
  import numpy
  import cv2
  import paddle
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: reverse_transform(pred, ori_shape, transforms, mode) and returns: pred