| 141 | } // namespace |
| 142 | |
| 143 | int entry(int argc, char **argv) |
| 144 | { |
| 145 | arser::Arser arser; |
| 146 | arser.add_argument("circle").help("Circle file you want to test"); |
| 147 | arser.add_argument("--input_data").required(true).help("Path to generate input data h5 file"); |
| 148 | arser.add_argument("--expected_data") |
| 149 | .required(true) |
| 150 | .help("Path to generate expected data h5 file"); |
| 151 | arser.add_argument("--fixed_seed") |
| 152 | .nargs(0) |
| 153 | .help("Put a fixed seed into the random number generator"); |
| 154 | arser.add_argument("--input_range") |
| 155 | .nargs(3) |
| 156 | .type(arser::DataType::STR_VEC) |
| 157 | .help("Set random number range [min max] for the input as 'name min max'"); |
| 158 | |
| 159 | try |
| 160 | { |
| 161 | arser.parse(argc, argv); |
| 162 | } |
| 163 | catch (const std::runtime_error &err) |
| 164 | { |
| 165 | std::cout << err.what() << std::endl; |
| 166 | std::cout << arser; |
| 167 | return 255; |
| 168 | } |
| 169 | |
| 170 | std::string circle_file = arser.get<std::string>("circle"); |
| 171 | |
| 172 | luci::ImporterEx importer; |
| 173 | auto module = importer.importVerifyModule(circle_file); |
| 174 | if (module == nullptr) |
| 175 | { |
| 176 | std::cerr << "ERROR: Failed to load circle '" << circle_file << "'" << std::endl; |
| 177 | return EXIT_FAILURE; |
| 178 | } |
| 179 | luci_interpreter::Interpreter interpreter(module.get()); |
| 180 | |
| 181 | /** |
| 182 | * HDF5 layout is like below |
| 183 | * |
| 184 | * GROUP "/" |
| 185 | * ㄴGROUP "name" |
| 186 | * ㄴATTRIBUTE "0" |
| 187 | * ㄴDATA (0): "input_01:0" |
| 188 | * ㄴATTRIBUTE "1" |
| 189 | * ㄴDATA (0): "input_02:0" |
| 190 | * ㄴGROUP "value" |
| 191 | * ㄴDATASET "0" |
| 192 | * ㄴDATA ... |
| 193 | * ㄴDATASET "1" |
| 194 | * ㄴDATA ... |
| 195 | */ |
| 196 | // create random data and dump into hdf5 file |
| 197 | H5::H5File input_file{arser.get<std::string>("--input_data"), H5F_ACC_TRUNC}; |
| 198 | std::unique_ptr<H5::Group> input_name_group = |
| 199 | std::make_unique<H5::Group>(input_file.createGroup("name")); |
| 200 | std::unique_ptr<H5::Group> input_value_group = |
nothing calls this directly
no test coverage detected