26 #ifndef LBANN_DATA_READER_HDF5_REVISED_HPP 27 #define LBANN_DATA_READER_HDF5_REVISED_HPP 40 #define HDF5_METADATA_KEY_DIMS "dims" 41 #define HDF5_METADATA_KEY_CHANNELS "channels" 42 #define HDF5_METADATA_KEY_ORDERING "ordering" 43 #define HDF5_METADATA_KEY_SCALE "scale" 44 #define HDF5_METADATA_KEY_BIAS "bias" 45 #define HDF5_METADATA_KEY_LAYOUT "layout" 46 #define HDF5_METADATA_KEY_TRANSPOSE "transpose" 47 #define HDF5_METADATA_KEY_COERCE "coerce" 48 #define HDF5_METADATA_KEY_PACK "pack" 50 #define HDF5_METADATA_VALUE_COERCE_FLOAT "float" 51 #define HDF5_METADATA_VALUE_COERCE_DOUBLE "double" 52 #define HDF5_METADATA_VALUE_COERCE_FLOAT64 "float64" 53 #define HDF5_METADATA_VALUE_COERCE_FLOAT16 "float16" 54 #define HDF5_METADATA_VALUE_LAYOUT_CHW "chw" 55 #define HDF5_METADATA_VALUE_LAYOUT_HWC "hwc" 56 #define HDF5_METADATA_VALUE_LAYOUT_CDHW "cdhw" 57 #define HDF5_METADATA_VALUE_LAYOUT_DHWC "dhwc" 64 conduit::Node
const& metadata);
102 std::string
get_type()
const override {
return "hdf5_data_reader"; }
114 void load()
override;
271 const std::vector<El::Int>
get_data_dims(std::string name =
"")
const;
289 conduit::Node* starting_node,
290 std::unordered_map<std::string, conduit::Node*>& schema_name_map);
298 std::unordered_map<std::string, conduit::Node*>& leaves_out);
308 std::unordered_map<std::string, conduit::Node*>& leaves_out);
318 const std::string& sample_name,
319 bool ignore_failure =
false);
325 bool ignore_failure =
false);
328 void pack_data(conduit::Node& node_in_out);
331 void load_schema(std::string filename, conduit::Node& schema);
334 void pack(conduit::Node& node,
size_t index);
341 const conduit::Node* node_B);
348 const std::string& path,
349 const conduit::Node& metadata);
352 void coerce(
const conduit::Node& metadata,
354 const std::string& original_path,
355 const std::string& new_pathname,
356 conduit::Node& node);
359 const std::string& path,
360 const conduit::Node& metadata);
380 template <
typename T>
381 void pack(std::string
const&
group_name, conduit::Node& node,
size_t index);
389 friend class ::DataReaderHDF5WhiteboxTester;
395 #endif // LBANN_DATA_READER_HDF5_REVISED_HPP int get_linearized_size(data_field_type const &data_field) const override
void load_sample(conduit::Node &node, hid_t file_handle, const std::string &sample_name, bool ignore_failure=false)
void get_schema_ptrs(conduit::Node *starting_node, std::unordered_map< std::string, conduit::Node *> &schema_name_map)
std::string conduit_to_string(conduit::Node const &field)
std::unordered_map< std::string, int > m_linearized_size_lookup_table
bool is_hdf5_metadata_key_valid(std::string const &key)
std::vector< std::string > names
void test_that_all_nodes_contain_metadata(conduit::Node &node)
#define HDF5_METADATA_KEY_COERCE
std::unordered_set< std::string > m_add_to_map
int get_num_responses() const override
Return the number of responses in this dataset.
conduit::Node m_experiment_schema
bool is_hdf5_field_channels_last(conduit::Node const &field)
bool m_delete_packed_fields
#define HDF5_METADATA_KEY_DIMS
static std::set< std::string > const hdf5_metadata_valid_keys
#define HDF5_METADATA_KEY_PACK
const std::string & get_experiment_schema_filename()
Returns the name of the yaml experiment file.
const std::string s_composite_node
#define HDF5_METADATA_KEY_BIAS
conduit::Node merge_metadata_nodes(const conduit::Node *node_A, const conduit::Node *node_B)
std::unordered_map< std::string, PackingGroup > m_packing_groups
hdf5_data_reader(bool shuffle=true)
conduit::Node get_data_schema() const
this method is made public for testing
const std::string s_metadata_node_name
std::string get_type() const override
void set_data_schema_filename(std::string fn)
Sets the name of the yaml data file.
#define HDF5_METADATA_KEY_CHANNELS
void adjust_metadata(conduit::Node *root)
this method is made public for testing
#define HDF5_METADATA_KEY_TRANSPOSE
void construct_linearized_size_lookup_tables()
void pack(conduit::Node &node, size_t index)
bool get_delete_packed_fields()
std::vector< conduit::index_t > data_types
int get_num_labels() const override
Return the number of labels (classes) in this dataset.
void print_metadata(std::ostream &os=std::cout)
Prints metadata and data-types for all field-names.
void load_sample_from_sample_list(conduit::Node &node, size_t index, bool ignore_failure=false)
const std::string & get_data_schema_filename()
Returns the name of the yaml data file.
int get_linearized_response_size() const override
Get the linearized size (i.e. number of elements) in a response.
std::string m_data_schema_filename
int get_linearized_label_size() const override
Get the linearized size (i.e. number of elements) in a label.
std::string m_experiment_schema_filename
std::unordered_map< std::string, conduit::Node > get_node_map() const
this method is made public for testing
std::unordered_map< std::string, std::vector< El::Int > > m_data_dims_lookup_table
void normalize(conduit::Node &node, const std::string &path, const conduit::Node &metadata)
bool fetch_conduit_node(conduit::Node &sample, int data_id) override
conduit::Node get_experiment_schema() const
this method is made public for testing
std::unordered_map< std::string, conduit::Node * > m_data_map
hdf5_data_reader * copy() const override
void get_leaves(conduit::Node *node_in, std::unordered_map< std::string, conduit::Node *> &leaves_out)
#define HDF5_METADATA_KEY_SCALE
void set_experiment_schema(const conduit::Node &s)
this method is made public for testing
const std::vector< El::Int > get_data_dims() const override
Get the dimensions of the data.
std::unordered_map< std::string, conduit::Node * > m_useme_node_map_ptrs
void build_packing_map(conduit::Node &node)
void repack_image(conduit::Node &node, const std::string &path, const conduit::Node &metadata)
void do_preload_data_store() override
std::vector< size_t > sizes
void set_data_schema(const conduit::Node &s)
this method is made public for testing
void set_delete_packed_fields(bool flag)
~hdf5_data_reader() override
conduit::Node m_data_schema
bool does_hdf5_field_require_repack_to_channels_first(conduit::Node const &metadata)
void get_leaves_multi(conduit::Node *node_in, std::unordered_map< std::string, conduit::Node *> &leaves_out)
void pack_data(conduit::Node &node_in_out)
std::string data_field_type
std::unordered_map< std::string, conduit::Node > m_useme_node_map
int get_linearized_data_size() const override
Get the linearized size (i.e. number of elements) in a sample.
#define HDF5_METADATA_KEY_LAYOUT
void set_experiment_schema_filename(std::string fn)
Sets the name of the yaml experiment file.
void load_sample_schema(conduit::Schema &s)
void load_schema(std::string filename, conduit::Node &schema)
void copy_members(const hdf5_data_reader &rhs)
#define HDF5_METADATA_KEY_ORDERING
bool is_composite_node(const conduit::Node &node) const
bool has_conduit_output() override
hdf5_data_reader & operator=(const hdf5_data_reader &)
void coerce(const conduit::Node &metadata, hid_t file_handle, const std::string &original_path, const std::string &new_pathname, conduit::Node &node)
conduit::index_t data_type