2 * Copyright (c) 2023 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_SOLVER_HOOKS_H__
18 #define __MPQSOLVER_SOLVER_HOOKS_H__
20 #include <luci/IR/Module.h>
22 #include <core/Quantizer.h>
35 * @brief called on the start of iterative search
36 * @param model_path path of original float model to quantize
37 * @param q8error error of Q8 quantization
38 * @param q16error error of Q16 quantization
40 virtual void on_begin_solver(const std::string &model_path, float q8error, float q16error) = 0;
43 * @brief called on the start of current iteration
45 virtual void on_begin_iteration() = 0;
48 * @brief called at the end of current iteration
49 * @param layers model nodes with specific quantization parameters
50 * @param def_dtype default quantization dtype
51 * @param error error of quantization for current iteration
53 virtual void on_end_iteration(const LayerParams &layers, const std::string &def_dtype,
54 float error) const = 0;
57 * @brief called at the end of iterative search
58 * @param layers model nodes with specific quantization parameters
59 * @param def_dtype default quantization dtype
60 * @param qerror final error of quantization
62 virtual void on_end_solver(const LayerParams &layers, const std::string &def_dtype,
67 } // namespace mpqsolver
69 #endif //__MPQSOLVER_SOLVER_HOOKS_H__