Train/Test split from one hdf5 file and one DataLoader

Is it possible to use one DataLoader, with a custom HDF5 dataset, from one HDF5 file to do train/val/test split with out having to open the HDF5 file multiple times?