未验证 提交 9551e466 编写于 作者: J joanna.wozna.intel 提交者: GitHub

Correct skip_quant condition (#43184)

上级 601d7a35
...@@ -349,9 +349,9 @@ std::unordered_set<std::string> ComputePropagateScalesMkldnnPass::UpdateScales( ...@@ -349,9 +349,9 @@ std::unordered_set<std::string> ComputePropagateScalesMkldnnPass::UpdateScales(
waiting_for_scale.insert(input_name); waiting_for_scale.insert(input_name);
waiting_for_scale.insert(output_name); waiting_for_scale.insert(output_name);
} else if (in_iter != var_quant_scales->end()) { } else if (in_iter != var_quant_scales->end()) {
out_iter->second = in_iter->second; (*var_quant_scales)[output_name] = in_iter->second;
} else if (out_iter != var_quant_scales->end()) { } else if (out_iter != var_quant_scales->end()) {
in_iter->second = out_iter->second; (*var_quant_scales)[input_name] = out_iter->second;
} }
} else if (op_name == "scale") { } else if (op_name == "scale") {
const std::string output_name = op_node->Op()->Output("Out")[0]; const std::string output_name = op_node->Op()->Output("Out")[0];
......
...@@ -38,7 +38,7 @@ void QuantDequantMkldnnPass::MarkSkipQuantizedOps( ...@@ -38,7 +38,7 @@ void QuantDequantMkldnnPass::MarkSkipQuantizedOps(
for (auto* node_input : op_node->inputs) { for (auto* node_input : op_node->inputs) {
for (auto* node_input_input : node_input->inputs) { for (auto* node_input_input : node_input->inputs) {
if (!node_input_input->IsOp()) continue; if (!node_input_input->IsOp()) continue;
if (node_input_input->Name().find("quantize_dequantize") == if (node_input_input->Name().find("quantize") ==
std::string::npos) { std::string::npos) {
is_quantized_op = false; is_quantized_op = false;
break; break;
......
...@@ -158,7 +158,7 @@ class Quant2Int8MkldnnPass(object): ...@@ -158,7 +158,7 @@ class Quant2Int8MkldnnPass(object):
is_quantized_op = True is_quantized_op = True
for var_node in op_node.inputs: for var_node in op_node.inputs:
for front_op_node in var_node.inputs: for front_op_node in var_node.inputs:
if "quantize_dequantize" not in front_op_node.name(): if "quantize" not in front_op_node.name():
is_quantized_op = False is_quantized_op = False
if not is_quantized_op: if not is_quantized_op:
op_node.op()._set_attr("skip_quant", True) op_node.op()._set_attr("skip_quant", True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册