code: def reverse_transform(pred, ori_shape, transforms, mode="trilinear"):
      """recover pred to origin shape"""
      reverse_list = get_reverse_list(ori_shape, transforms)
      intTypeList = [
          paddle.int8,
          paddle.int16,
          paddle.int32,
          paddle.int64,
      ]
      dtype = pred.dtype
      for item in reverse_list[::-1]:
          if item[0] == "resize":
              d, h, w = item[1][0], item[1][1], item[1][2]
              if paddle.get_device() == "cpu" and dtype in intTypeList:
                  pred = paddle.cast(pred, "float32")
                  pred = F.interpolate(pred, (d, h, w), mode=mode)
                  pred = paddle.cast(pred, dtype)
              else:
                  pred = F.interpolate(pred, (d, h, w), mode=mode)
          else:
              raise Exception(
                  "Unexpected info '{}' in im_info".format(item[0])
              )
      return pred
  
file_path: PaddleSeg/contrib/MedicalSeg/medicalseg/core/infer.py
imports: import collections.abc
  import paddle
  import paddle
  import paddle.nn.functional
  import math
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