HEBench
hebench_dataset_loader.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef _HEBench_Harness_DatasetLoader_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_DatasetLoader_H_0596d40a3cce4b108a81595c50eb286d
7 
8 #include <cstdint>
9 #include <string>
10 #include <type_traits>
11 #include <vector>
12 
13 namespace hebench {
14 namespace DataLoader {
15 
16 template <typename T>
18 {
26  std::vector<std::vector<std::vector<T>>> inputs;
34  std::vector<std::vector<std::vector<T>>> outputs;
35 };
36 
37 template <typename T,
38  // Only `int32_t`, `int64_t`, `float`, and `double` are supported as types.
39  typename = std::enable_if_t<std::is_same_v<T, std::int32_t> || std::is_same_v<T, std::int64_t> || std::is_same_v<T, float> || std::is_same_v<T, double>>>
41 {
42 public:
62  static ExternalDataset<T> loadFromCSV(const std::string &filename,
63  std::uint64_t max_loaded_size = 0);
64 };
65 
66 // template implementations
67 
68 template class ExternalDatasetLoader<int32_t>;
69 template class ExternalDatasetLoader<int64_t>;
70 template class ExternalDatasetLoader<float>;
71 template class ExternalDatasetLoader<double>;
72 
73 } // namespace DataLoader
74 } // namespace hebench
75 
76 #endif // defined _HEBench_Harness_DatasetLoader_H_0596d40a3cce4b108a81595c50eb286d
static ExternalDataset< T > loadFromCSV(const std::string &filename, std::uint64_t max_loaded_size=0)
Loads a dataset from an external csv file that follows the defined structure.
std::vector< std::vector< std::vector< T > > > inputs
Contains the samples for each input parameter as loaded from external source.
std::vector< std::vector< std::vector< T > > > outputs
Contains the samples for each result component as loaded from external source.