2 * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __MPQSOLVER_MPQSOLEVR_SOLVER_H__
18 #define __MPQSOLVER_MPQSOLEVR_SOLVER_H__
20 #include <core/DumpingHooks.h>
32 * @brief construct Solver using input_data_path for .h5 file,
33 * qerror_ratio to set target qerror, and input_quantization/output_quantization to set
34 * quantization type at input/output respectively
36 MPQSolver(const std::string &input_data_path, float qerror_ratio,
37 const std::string &input_quantization, const std::string &output_quantization);
38 virtual ~MPQSolver() = default;
41 * @brief run solver for recorded float module at module_path
43 virtual std::unique_ptr<luci::Module> run(const std::string &module_path) = 0;
46 * @brief set all intermediate artifacts to be saved
48 void set_save_intermediate(const std::string &save_path);
51 std::string _input_data_path;
52 std::string _input_quantization;
53 std::string _output_quantization;
54 float _qerror_ratio = 0.f; // quantization error ratio
55 std::unique_ptr<core::DumpingHooks> _hooks;
58 } // namespace mpqsolver
60 #endif //__MPQSOLVER_MPQSOLEVR_SOLVER_H__