class_docstr: Write datapoints to a HDF5 file.
  
  Note that HDF5 files are in fact not very performant and currently do not support lazy loading.
  It's better to use :class:`LMDBSerializer`.
class_docstr_tok: ["Write","datapoints","to","a","HDF5","file",".","Note","that","HDF5","files","are","in","fact","not","very","performant","and","currently","do","not","support","lazy","loading",".","It","'s","better","to","use",":","class",":","`","LMDBSerializer","`","."]
docstr: Args:
      df (DataFlow): the DataFlow to serialize.
      path (str): output hdf5 file.
      data_paths (list[str]): list of h5 paths. It should have the same
          length as each datapoint, and each path should correspond to one
          component of the datapoint.
docstr_tok: ["Args",":","df","(","DataFlow",")",":","the","DataFlow","to","serialize",".","path","(","str",")",":","output","hdf5","file",".","data_paths","(","list","[","str","]",")",":","list","of","h5","paths",".","It","should","have","the","same","length","as","each","datapoint",",","and","each","path","should","correspond","to","one","component","of","the","datapoint","."]
code: def save(df, path, data_paths):
      """
      Args:
          df (DataFlow): the DataFlow to serialize.
          path (str): output hdf5 file.
          data_paths (list[str]): list of h5 paths. It should have the same
              length as each datapoint, and each path should correspond to one
              component of the datapoint.
      """
      size = _reset_df_and_get_size(df)
      buffer = defaultdict(list)
  
      with get_tqdm(total=size) as pbar:
          for dp in df:
              assert len(dp) == len(
                  data_paths
              ), "Datapoint has {} components!".format(len(dp))
              for k, el in zip(data_paths, dp):
                  buffer[k].append(el)
              pbar.update()
  
      with h5py.File(path, "w") as hf, get_tqdm(
          total=len(data_paths)
      ) as pbar:
          for data_path in data_paths:
              hf.create_dataset(data_path, data=buffer[data_path])
              pbar.update()
  
imports: import numpy
  import os
  import platform
  from collections import defaultdict
  from ..utils import logger
  from ..utils.serialize import dumps, loads
  from ..utils.develop import create_dummy_class
  from ..utils.utils import get_tqdm
  from .base import DataFlow
  from .common import FixedSizeData, MapData
  from .format import HDF5Data, LMDBData, DiskCacheData
  from .raw import DataFromGenerator, DataFromList
label_desc: Use image node_id 1 for calling the HDF5Serializer obj's underlying member method code with example usage: obj.save(df, path, data_paths) without return types