code: def get_padded_torch_tensor(batch_field, dtype=None, pad_val=0):
      """
      例如:
          [[1,2], [3]] -> torch.LongTensor([[1, 2], [3, 0]])
  
      :param batch_field: 需要 pad 的对象。需要保证应该是可以进行 pad 的。支持 1d（多为句子长度）/2d（多为文本序列）/3d（多为字符序列）
          /4d（多为图片）。
      :param dtype: 目标类别是什么
      :param pad_val: pad 的 value
      :return:
      """
      shapes = get_shape(batch_field)
      tensor = torch.full(shapes, dtype=dtype, fill_value=pad_val)
      tensor = fill_tensor(batch_field, tensor, dtype=dtype)
      return tensor
  
imports: from inspect import isclass
  import numpy
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from .padder import Padder
  from .utils import is_number_or_numpy_number, is_number, is_numpy_number_dtype, get_shape, is_numpy_generic_class
  from .exceptions import *
label_desc: Use image node_id 4 for calling a global function with example usage: get_padded_torch_tensor(batch_field, dtype, pad_val) and returns: tensor