| 203 | { |
| 204 | |
| 205 | TEST(CircleEvalMetricPrinterTest, MAE_simple) |
| 206 | { |
| 207 | luci::Module first; |
| 208 | AddOneGraph first_g; |
| 209 | first_g.init(); |
| 210 | |
| 211 | first.add(std::move(first_g.graph())); |
| 212 | |
| 213 | luci::Module second; |
| 214 | AddTwoGraph second_g; |
| 215 | second_g.init(); |
| 216 | |
| 217 | second.add(std::move(second_g.graph())); |
| 218 | |
| 219 | MAEPrinter mae; |
| 220 | |
| 221 | mae.init(&first, &second); |
| 222 | |
| 223 | // This test does not actually evaluate the modules, but create |
| 224 | // fake results. |
| 225 | std::vector<std::shared_ptr<Tensor>> first_result; |
| 226 | { |
| 227 | auto output = output_tensor_with_value(&first, 1.0); |
| 228 | first_result.emplace_back(output); |
| 229 | } |
| 230 | |
| 231 | std::vector<std::shared_ptr<Tensor>> second_result; |
| 232 | { |
| 233 | auto output = output_tensor_with_value(&second, 2.0); |
| 234 | second_result.emplace_back(output); |
| 235 | } |
| 236 | |
| 237 | mae.accumulate(first_result, second_result); |
| 238 | |
| 239 | std::stringstream ss; |
| 240 | mae.dump(ss); |
| 241 | std::string result = ss.str(); |
| 242 | |
| 243 | EXPECT_NE(std::string::npos, result.find("MAE for output_0 is 1")); |
| 244 | } |
| 245 | |
| 246 | TEST(CircleEvalMetricPrinterTest, MAE_init_with_null_NEG) |
| 247 | { |
nothing calls this directly
no test coverage detected