1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_MINI_BENCHMARK_TEST_HELPER_H_ 16 #define TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_MINI_BENCHMARK_TEST_HELPER_H_ 17 18 #include <string> 19 20 namespace tflite { 21 namespace acceleration { 22 23 class MiniBenchmarkTestHelper { 24 public: 25 // Dump the in-memory binary data stream to the testing temporary directory w/ 26 // a file name as 'filename'. 27 // It retruns the full file path of the dumped file. 28 static std::string DumpToTempFile(const std::string& filename, 29 const unsigned char* data, size_t length); 30 31 // The constructor will check whether the testing environment supports to run 32 // the mini benchmark. If yes, it will do additional testing setup 33 // accordingly. 34 MiniBenchmarkTestHelper(); ~MiniBenchmarkTestHelper()35 ~MiniBenchmarkTestHelper() {} should_perform_test()36 bool should_perform_test() const { return should_perform_test_; } 37 38 private: 39 bool should_perform_test_; 40 }; 41 42 } // namespace acceleration 43 } // namespace tflite 44 #endif // TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_MINI_BENCHMARK_TEST_HELPER_H_ 45