code: def nested_tensor_from_tensor_list(tensor_list):
      def _max_by_axis(the_list):
          maxes = the_list[0]
          for sublist in the_list[1:]:
              for index, item in enumerate(sublist):
                  maxes[index] = max(maxes[index], item)
          return maxes
  
      if tensor_list[0].ndim == 3:
          max_size = _max_by_axis(
              [list(img.shape) for img in tensor_list]
          )
          batch_shape = [len(tensor_list)] + max_size
          b, c, h, w = batch_shape
          tensor = paddle.zeros(batch_shape, dtype=tensor_list[0].dtype)
          mask = paddle.ones((b, h, w), dtype="bool")
  
          for i in range(tensor.shape[0]):
              img = tensor_list[i]
              tensor[
                  i, : img.shape[0], : img.shape[1], : img.shape[2]
              ] = copy.deepcopy(img)
              mask[i, : img.shape[1], : img.shape[2]] = False
      else:
          raise ValueError("not supported")
      return tensor, mask
  
imports: import copy
  import numpy
  from scipy.optimize import linear_sum_assignment
  import paddle
  import paddle.nn
  import paddle.distributed
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 5 for calling a global function with example usage: nested_tensor_from_tensor_list(tensor_list) and returns: tensor,  mask, maxes