2 * Copyright (c) 2020 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 __LUCI_CIRCLE_OPTIMIZER_H__
18 #define __LUCI_CIRCLE_OPTIMIZER_H__
28 class CircleOptimizer final
35 FuseBatchNormWithTConv,
39 ResolveCustomOpBatchMatMul,
40 ResolveCustomOpMatMul,
41 QuantizeDequantizeWeights,
46 enum AlgorithmParameters
49 Quantize_output_dtype,
50 Quantize_granularity // layer-wise or channel-wise
53 virtual ~Options() = default;
55 virtual void enable(Algorithm) = 0;
56 virtual bool query(Algorithm) = 0;
57 virtual void param(AlgorithmParameters, const std::string &) = 0;
58 virtual const std::string param(AlgorithmParameters) const = 0;
62 // TODO maybe caller can provide Options as ctor parameters
63 Options *options(void);
66 void optimize(loco::Graph *) const;
68 void quantize(loco::Graph *) const;
71 std::unique_ptr<Options> _options;
76 #endif // __LUCI_CIRCLE_OPTIMIZER_H__