code: def tensor_vstack(tensor_list, pad=0):
      """
      vertically stack tensors
      :param tensor_list: list of tensor to be stacked vertically
      :param pad: label to pad with
      :return: tensor with max shape
      """
      ndim = len(tensor_list[0].shape)
      dtype = tensor_list[0].dtype
      islice = tensor_list[0].shape[0]
      dimensions = []
      first_dim = sum([tensor.shape[0] for tensor in tensor_list])
      dimensions.append(first_dim)
      for dim in range(1, ndim):
          dimensions.append(
              max([tensor.shape[dim] for tensor in tensor_list])
          )
      if pad == 0:
          all_tensor = np.zeros(tuple(dimensions), dtype=dtype)
      elif pad == 1:
          all_tensor = np.ones(tuple(dimensions), dtype=dtype)
      else:
          all_tensor = np.full(tuple(dimensions), pad, dtype=dtype)
      if ndim == 1:
          for ind, tensor in enumerate(tensor_list):
              all_tensor[ind * islice : (ind + 1) * islice] = tensor
      elif ndim == 2:
          for ind, tensor in enumerate(tensor_list):
              all_tensor[
                  ind * islice : (ind + 1) * islice, : tensor.shape[1]
              ] = tensor
      elif ndim == 3:
          for ind, tensor in enumerate(tensor_list):
              all_tensor[
                  ind * islice : (ind + 1) * islice,
                  : tensor.shape[1],
                  : tensor.shape[2],
              ] = tensor
      elif ndim == 4:
          for ind, tensor in enumerate(tensor_list):
              all_tensor[
                  ind * islice : (ind + 1) * islice,
                  : tensor.shape[1],
                  : tensor.shape[2],
                  : tensor.shape[3],
              ] = tensor
      elif ndim == 5:
          for ind, tensor in enumerate(tensor_list):
              all_tensor[
                  ind * islice : (ind + 1) * islice,
                  : tensor.shape[1],
                  : tensor.shape[2],
                  : tensor.shape[3],
                  : tensor.shape[4],
              ] = tensor
      else:
          print(tensor_list[0].shape)
          raise Exception("Sorry, unimplemented.")
      return all_tensor
  
imports: from __future__ import print_function
  import numpy
  import cv2
  import os
  import math
  import sys
  import random
  from ..config import config
label_desc: Use image node_id 15 for calling a global function with example usage: tensor_vstack(tensor_list, pad) and returns: all_tensor