code: def nested_tensor_from_tensor_list(tensor_list):
      if tensor_list[0].ndim == 3:
          max_size = _max_by_axis(
              [list(img.shape) for img in tensor_list]
          )
          # min_size = tuple(min(s) for s in zip(*[img.shape for img in tensor_list]))
          batch_shape = [len(tensor_list)] + max_size
          b, c, h, w = batch_shape
          dtype = tensor_list[0].dtype
          tensor = paddle.zeros(batch_shape, dtype=dtype)
          mask = paddle.ones((b, h, w), dtype="bool")
          # Automatically pad images and masks
          for i in range(b):
              img = tensor_list[i]
              tensor[
                  i, : img.shape[0], : img.shape[1], : img.shape[2]
              ] = img
              mask[i, : img.shape[1], : img.shape[2]] = False
      else:
          raise ValueError("not supported")
      return NestedTensor(tensor, mask)
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from scipy.optimize import linear_sum_assignment
  from paddlepanseg.cvlibs import manager, build_info_dict
  from paddlepanseg.core.runner import PanSegRunner
label_desc: Use image node_id 9 for calling a global function with example usage: nested_tensor_from_tensor_list(tensor_list) and returns: NestedTensor