test_tflite_model_executor.h 1001 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_TEST_TFLITE_MODEL_EXECUTOR_H_
  5. #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_TEST_TFLITE_MODEL_EXECUTOR_H_
  6. #include "components/optimization_guide/core/base_model_executor.h"
  7. namespace optimization_guide {
  8. class TestTFLiteModelExecutor
  9. : public BaseModelExecutor<std::vector<float>, const std::vector<float>&> {
  10. public:
  11. TestTFLiteModelExecutor() = default;
  12. ~TestTFLiteModelExecutor() override = default;
  13. protected:
  14. bool Preprocess(const std::vector<TfLiteTensor*>& input_tensors,
  15. const std::vector<float>& input) override;
  16. absl::optional<std::vector<float>> Postprocess(
  17. const std::vector<const TfLiteTensor*>& output_tensors) override;
  18. };
  19. } // namespace optimization_guide
  20. #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_TEST_TFLITE_MODEL_EXECUTOR_H_