keras.utils.io_utils.HDF5Matrix(datapath, dataset, start=0, end=None, normalizer=None)

Representation of HDF5 dataset which can be used instead of a Numpy array.


X_data = HDF5Matrix('input/file.hdf5', 'data')

Providing start and end allows use of a slice of the dataset.

Optionally, a normalizer function (or lambda) can be given. This will be called on every slice of data retrieved.


  • datapath: string, path to a HDF5 file
  • dataset: string, name of the HDF5 dataset in the file specified in datapath
  • start: int, start of desired slice of the specified dataset
  • end: int, end of desired slice of the specified dataset
  • normalizer: function to be called on data when retrieved