docstr: 将 nested 的 dict 中的内容展开到一个 flat dict 中
  
  :param batch: 需要 unpack 的 batch 数据。
  :param ignore_fields: 需要忽略的 field 。
  :param input_fields: 需要设置为 input 的 field 。
  :return:
docstr_tok: ["\u5c06","nested","\u7684","dict","\u4e2d\u7684\u5185\u5bb9\u5c55\u5f00\u5230\u4e00\u4e2a","flat","dict","\u4e2d",":","param","batch",":","\u9700\u8981","unpack","\u7684","batch","\u6570\u636e\u3002",":","param","ignore_fields",":","\u9700\u8981\u5ffd\u7565\u7684","field","\u3002",":","param","input_fields",":","\u9700\u8981\u8bbe\u7f6e\u4e3a","input","\u7684","field","\u3002",":","return",":"]
code: def unpack_batch(
      batch: Sequence[Mapping], ignore_fields: set, input_fields: Dict
  ) -> Dict:
      """
      将 nested 的 dict 中的内容展开到一个 flat dict 中
  
      :param batch: 需要 unpack 的 batch 数据。
      :param ignore_fields: 需要忽略的 field 。
      :param input_fields: 需要设置为 input 的 field 。
      :return:
      """
      dict_batch = defaultdict(list)
      for sample in batch:
          for key, value in sample.items():
              if key in ignore_fields:
                  continue
              if isinstance(value, Mapping) and key not in input_fields:
                  _dict_batch = _unpack_batch_nested_mapping(
                      value, ignore_fields, input_fields, _parent=(key,)
                  )
                  for key, value in _dict_batch.items():
                      dict_batch[key].append(value)
              else:
                  dict_batch[key].append(value)
      return dict_batch
  
file_path: fastNLP/fastNLP/core/collators/packer_unpacker.py
imports: from collections import defaultdict
  from functools import reduce
  from typing import Sequence, Mapping, Dict
label_desc: Use image node_id 1 for calling the NestedMappingPackerUnpacker obj's underlying member method code with example usage: obj.unpack_batch(batch, ignore_fields, input_fields) and returns: dict_batch