| 35 | } |
| 36 | |
| 37 | bool Interpret(const char* examples_filename, bool use_nnapi) { |
| 38 | std::ifstream tflite_stream(examples_filename); |
| 39 | if (!tflite_stream.is_open()) { |
| 40 | fprintf(stderr, "Can't open input file."); |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | printf("Use nnapi is set to: %d\n", use_nnapi); |
| 45 | tflite::testing::TfLiteDriver test_driver( |
| 46 | use_nnapi ? tflite::testing::TfLiteDriver::DelegateType::kNnapi |
| 47 | : tflite::testing::TfLiteDriver::DelegateType::kNone); |
| 48 | |
| 49 | test_driver.SetModelBaseDir(dirname(examples_filename)); |
| 50 | if (!tflite::testing::ParseAndRunTests(&tflite_stream, &test_driver)) { |
| 51 | fprintf(stderr, "Results from tflite don't match."); |
| 52 | return false; |
| 53 | } |
| 54 | |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | int main(int argc, char* argv[]) { |
| 59 | bool use_nnapi = true; |
no test coverage detected