code: def stack_and_pad_tensor_dict_list(tensor_dict_list, max_len):
      """Stack and pad array of list of tensors.
  
      Input paths are a list of N dicts, each with values of shape
      :math:`(D, S^*)`. This function stack and pad the values with the input
      key with max_len, so output will be shape :math:`(N, D, S^*)`.
  
      Args:
          tensor_dict_list (list[dict]): List of dict to be stacked and padded.
              Value of each dict will be shape of :math:`(D, S^*)`.
          max_len (int): Maximum length for padding.
  
      Returns:
          dict: a dictionary of {stacked tensors or dictionary of
              stacked tensors}. Shape: :math:`(N, D, S^*)`
              where N is the len of input paths.
  
      """
      keys = list(tensor_dict_list[0].keys())
      ret = dict()
      for k in keys:
          example = tensor_dict_list[0][k]
          dict_list = [x[k] if k in x else [] for x in tensor_dict_list]
  
          if isinstance(example, dict):
              v = stack_and_pad_tensor_dict_list(dict_list, max_len)
          else:
              v = pad_tensor_n(np.array(dict_list), max_len)
          ret[k] = v
  
      return ret
  
file_path: garage/src/garage/np/_functions.py
imports: import warnings
  import numpy
  import scipy.signal
label_desc: Use image node_id 11 for calling a global function with example usage: stack_and_pad_tensor_dict_list(tensor_dict_list, max_len) and returns: ret