提交 7e2ecbd6 编写于 作者: N nhzlx

add some int8 option

上级 9d127391
...@@ -50,6 +50,7 @@ class ExecutorLite { ...@@ -50,6 +50,7 @@ class ExecutorLite {
optimizer_.KernelPickPreferPlace(prefer_place); optimizer_.KernelPickPreferPlace(prefer_place);
core::KernelPickFactor factor; core::KernelPickFactor factor;
factor.ConsiderTarget(); factor.ConsiderTarget();
factor.ConsiderPrecision();
optimizer_.Run(std::move(program), valid_places, factor); optimizer_.Run(std::move(program), valid_places, factor);
program_ = optimizer_.GenRuntimeProgram(); program_ = optimizer_.GenRuntimeProgram();
} }
......
...@@ -25,7 +25,7 @@ namespace fusion { ...@@ -25,7 +25,7 @@ namespace fusion {
/* The model trained by fluid quantization is a simulation of real int8. /* The model trained by fluid quantization is a simulation of real int8.
* The quantized Ops(conv2d, mul, depthwise conv2d etc) have fake_quantop * The quantized Ops(conv2d, mul, depthwise conv2d etc) have fake_quantop
* in front and fake_dequantop behind. * in front and fake_dequantop behind.
* *
* When in int8 mode, the pattern like "fake_quant + quantized_op + * When in int8 mode, the pattern like "fake_quant + quantized_op +
* fake_dequant" * fake_dequant"
......
...@@ -41,7 +41,7 @@ void FuseBase::DeleteInterNodes(SSAGraph *graph) { ...@@ -41,7 +41,7 @@ void FuseBase::DeleteInterNodes(SSAGraph *graph) {
} }
} }
LOG(INFO) << "keys: " << key2nodes_.size(); VLOG(4) << "keys: " << key2nodes_.size();
std::unordered_set<const Node *> nodes2rm; std::unordered_set<const Node *> nodes2rm;
for (auto &matched : key2nodes_) { for (auto &matched : key2nodes_) {
for (const auto &key : keys) { for (const auto &key : keys) {
......
...@@ -96,6 +96,7 @@ KernelRegistry::KernelRegistry() ...@@ -96,6 +96,7 @@ KernelRegistry::KernelRegistry()
INIT_FOR(kX86, kAny, kAny); INIT_FOR(kX86, kAny, kAny);
INIT_FOR(kARM, kFloat, kNCHW); INIT_FOR(kARM, kFloat, kNCHW);
INIT_FOR(kARM, kInt8, kNCHW);
INIT_FOR(kARM, kAny, kNCHW); INIT_FOR(kARM, kAny, kNCHW);
INIT_FOR(kARM, kAny, kAny); INIT_FOR(kARM, kAny, kAny);
#undef INIT_FOR #undef INIT_FOR
......
...@@ -80,6 +80,8 @@ class KernelRegistry final { ...@@ -80,6 +80,8 @@ class KernelRegistry final {
KernelRegistryForTarget<TARGET(kARM), PRECISION(kAny), KernelRegistryForTarget<TARGET(kARM), PRECISION(kAny),
DATALAYOUT(kAny)> *, // DATALAYOUT(kAny)> *, //
KernelRegistryForTarget<TARGET(kARM), PRECISION(kFloat), KernelRegistryForTarget<TARGET(kARM), PRECISION(kFloat),
DATALAYOUT(kNCHW)> *, //
KernelRegistryForTarget<TARGET(kARM), PRECISION(kInt8),
DATALAYOUT(kNCHW)> * // DATALAYOUT(kNCHW)> * //
>; >;
......
...@@ -58,7 +58,6 @@ class Optimizer { ...@@ -58,7 +58,6 @@ class Optimizer {
#ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK #ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
"lite_elementwise_add_activation_fuse_pass", // "lite_elementwise_add_activation_fuse_pass", //
#endif #endif
"lite_fc_fuse_pass", //
"static_kernel_pick_pass", // "static_kernel_pick_pass", //
"variable_place_inference_pass", // "variable_place_inference_pass", //
"argument_type_display_pass", // "argument_type_display_pass", //
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册