code: def fill_array(batch_field: List, padded_batch: np.ndarray):
      """
      将 batch_field 中的值填入到 array 中。
  
      :param batch_field: 需要填充进入 array 中的内容
      :param padded_batch: 待填充的 np.ndarray
      :return:
      """
      if padded_batch.ndim == 2:
          for i, content_i in enumerate(batch_field):
              padded_batch[i, : len(content_i)] = content_i
      elif padded_batch.ndim == 3:
          for i, content_i in enumerate(batch_field):
              for j, content_ii in enumerate(content_i):
                  padded_batch[i, j, : len(content_ii)] = content_ii
      elif padded_batch.ndim == 4:
          try:  # 应该是图像，所以直接应该就 ok 了。
              padded_batch = np.array(batch_field)
          except:
              for i, content_i in enumerate(batch_field):
                  for j, content_ii in enumerate(content_i):
                      for k, content_iii in enumerate(content_ii):
                          padded_batch[
                              i, j, k, : len(content_iii)
                          ] = content_iii
      elif padded_batch.ndim == 1:
          padded_batch[:] = batch_field
      else:
          raise RuntimeError(
              "fastNLP does not support padding for more than 3 dimensions. If you need this, please "
              "report."
          )
      return padded_batch
  
file_path: fastNLP/fastNLP/core/collators/padders/utils.py
imports: from typing import Sequence, List
  import re
  from inspect import isclass
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: fill_array(batch_field, padded_batch) and returns: padded_batch