提交 8ead391d 编写于 作者: N nhzlx

fix ci error

上级 e8ebb084
......@@ -99,15 +99,12 @@ void QuantDequantOpFuser::InsertNewNode(SSAGraph* graph,
const int kNumFields = 5;
const int kQuantizedWeightOffset = 0;
const int kQuantizedOpOffset = 1;
const int kQuantizedOpOutOffset = 2;
const int kDequantOpOffset = 3;
const int kDequantOpOutOffset = 4;
auto* quant_op_input = matched.at("quant_op_input");
auto* quant_op_in_scale = matched.at("quant_op_in_scale");
auto* quant_op = matched.at("quant_op");
auto* quant_op_out_scale = matched.at("quant_op_out_scale");
auto* quant_op_out = matched.at("quant_op_out");
std::vector<Node*> nodes;
for (int i = 0; i < times_; i++) {
......
......@@ -23,6 +23,18 @@ namespace lite {
namespace mir {
namespace fusion {
/* The model trained by fluid quantization is a simulation of real int8.
* The quantized Ops(conv2d, mul, depthwise conv2d etc) have fake_quantop
* in front and fake_dequantop behind.
*
* When in int8 mode, the pattern like "fake_quant + quantized_op +
* fake_dequant"
* can be detected by this fuser. The fuser extract the input_scale and
* the weight_scale info from fake_quant, fake_dequant op and fuse those into
* the quantized_op.
* In addition, the fuser delete fake_quant and fake_dequant op in the graph at
* the last.
*/
class QuantDequantOpFuser : public FuseBase {
public:
explicit QuantDequantOpFuser(const std::string& op_type,
......
......@@ -48,22 +48,22 @@ class Optimizer {
if (passes.empty()) {
RunPasses(std::vector<std::string>{{
"lite_quant_dequant_fuse_pass", //
"lite_conv_bn_fuse_pass", //
"lite_quant_dequant_fuse_pass", //
"lite_conv_bn_fuse_pass", //
"lite_conv_elementwise_add_activation_fuse_pass", //
#ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
"lite_elementwise_add_activation_fuse_pass", //
#endif
"lite_fc_fuse_pass", //
"static_kernel_pick_pass", //
"variable_place_inference_pass", //
"argument_type_display_pass", //
"type_target_transform_pass", //
"variable_place_inference_pass", //
"argument_type_display_pass", //
"io_copy_kernel_pick_pass", //
"variable_place_inference_pass", //
"runtime_context_assign_pass", //
"lite_fc_fuse_pass", //
"static_kernel_pick_pass", //
"variable_place_inference_pass", //
"argument_type_display_pass", //
"type_target_transform_pass", //
"variable_place_inference_pass", //
"argument_type_display_pass", //
"io_copy_kernel_pick_pass", //
"variable_place_inference_pass", //
"runtime_context_assign_pass", //
}});
} else {
RunPasses(passes);
......
......@@ -33,9 +33,9 @@ class FakeDequantizeMaxAbsOpLite : public OpLite {
explicit FakeDequantizeMaxAbsOpLite(const std::string &type) : OpLite(type) {}
bool CheckShape() const override {}
bool CheckShape() const override { return true; }
bool InferShape() const override {}
bool InferShape() const override { return true; }
bool AttachImpl(const cpp::OpDesc &op_desc, lite::Scope *scope) override {
auto x = op_desc.Input("X").front();
......
......@@ -34,9 +34,9 @@ class FakeQuantizeMovingAvgMaxAbsOpLite : public OpLite {
explicit FakeQuantizeMovingAvgMaxAbsOpLite(const std::string &type)
: OpLite(type) {}
bool CheckShape() const override {}
bool CheckShape() const override { return true; }
bool InferShape() const override {}
bool InferShape() const override { return true; }
bool AttachImpl(const cpp::OpDesc &op_desc, lite::Scope *scope) override {
auto x = op_desc.Input("X").front();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册