code: def reverse_transform(
      pred: paddle.Tensor,
      ori_shape: list,
      transforms: Callable,
      mode: str = "nearest",
  ) -> paddle.Tensor:
      """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] == "crop":
              up_h_off, down_h_off = item[1][0], item[1][1]
              left_w_off, right_w_off = item[2][0], item[2][1]
              pred = F.pad(
                  pred,
                  [left_w_off, right_w_off, up_h_off, down_h_off],
                  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: PaddleHub/modules/image/semantic_segmentation/bisenet_lane_segmentation/processor.py
imports: import base64
  import collections.abc
  from itertools import combinations
  from typing import Union, List, Tuple, Callable
  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