39 #ifndef LBANN_DATA_READER_HDF5_HPP 40 #define LBANN_DATA_READER_HDF5_HPP 41 #include "conduit/conduit.hpp" 63 template <
typename TensorDataType>
68 const std::string key_data,
69 const std::string key_label,
70 const std::string key_responses,
71 const bool hyperslab_labels);
80 std::string
get_type()
const override {
return "data_reader_hdf5_images"; }
129 #ifdef LBANN_HAS_DISTCONV 130 bool is_tensor_shuffle_required()
const override {
return false; }
131 #endif // LBANN_HAS_DISTCONV 137 TensorDataType* sample);
139 read_hdf5_sample(
int data_id, TensorDataType* sample, TensorDataType* labels);
141 void load_sample(conduit::Node& node,
int data_id);
147 int mb_idx)
override;
171 #endif // LBANN_DATA_READER_HDF5_HPP hdf5_reader * copy() const override
std::vector< float > m_all_responses
virtual int get_linearized_response_size() const
Get the linearized size (i.e. number of elements) in a response.
int get_num_labels() const override
Return the number of labels (classes) in this dataset.
bool fetch_response(CPUMat &Y, int data_id, int mb_idx) override
const std::vector< El::Int > get_data_dims() const override
Get the dimensions of the data.
hid_t get_hdf5_data_type() const
void set_hdf5_paths(const std::vector< std::string > hdf5_paths)
void read_hdf5_hyperslab(hsize_t h_data, hsize_t filespace, int rank, TensorDataType *sample)
static const std::string HDF5_KEY_LABELS
std::string m_key_responses
void load_sample(conduit::Node &node, int data_id)
virtual bool has_responses() const
std::string get_type() const override
std::vector< std::string > m_file_paths
bool fetch_label(CPUMat &Y, int data_id, int mb_idx) override
El::Matrix< DataType, El::Device::CPU > CPUMat
hdf5_reader & operator=(const hdf5_reader &)
void set_num_responses(const size_t num_responses)
hdf5_reader(const bool shuffle, const std::string key_data, const std::string key_label, const std::string key_responses, const bool hyperslab_labels)
int get_linearized_response_size() const override
Get the linearized size (i.e. number of elements) in a response.
void fetch_datum_conduit(Mat &X, int data_id)
int get_linearized_data_size() const override
Get the linearized size (i.e. number of elements) in a sample.
void copy_members(const hdf5_reader &rhs)
MPI_Comm m_response_gather_comm
std::vector< hsize_t > m_hyperslab_dims
std::vector< El::Int > m_data_dims
El::Matrix< DataType, El::Device::CPU > Mat
bool fetch_data_field(data_field_type data_field, CPUMat &Y, int data_id, int mb_idx) override
Called by fetch_data, fetch_label, fetch_response.
virtual int get_num_labels() const
Return the number of labels (classes) in this dataset.
std::string data_field_type
static const std::string HDF5_KEY_RESPONSES
virtual int get_linearized_label_size() const
Get the linearized size (i.e. number of elements) in a label.
virtual int get_num_responses() const
Return the number of responses in this dataset.
conduit::DataType get_conduit_data_type(conduit::index_t num_elements) const
void read_hdf5_sample(int data_id, TensorDataType *sample, TensorDataType *labels)
bool fetch_datum(CPUMat &X, int data_id, int mb_idx) override
virtual bool has_labels() const
int get_num_responses() const override
Return the number of responses in this dataset.
static const std::string HDF5_KEY_DATA
int get_linearized_label_size() const override
Get the linearized size (i.e. number of elements) in a label.