提交 6ec4792d 编写于 作者: H hong19860320 提交者: GitHub

[Core] Fix the output_scale for the last quantized op (#3239)

上级 9044bfad
......@@ -58,6 +58,11 @@ void QuantizedOpAttributesInferencePass::Apply(
}
if (found) {
inst.mutable_op_info()->SetAttr("output_scale", output_scale);
} else if (op_info->HasAttr("output_scale")) {
int bit_length = op_info->GetAttr<int>("bit_length");
int range = (1 << (bit_length - 1)) - 1;
output_scale = op_info->GetAttr<float>("output_scale");
inst.mutable_op_info()->SetAttr("output_scale", output_scale / range);
}
if (op_info->HasAttr("output_scale")) {
inst.mutable_op_info()->SetAttr("enable_int8", true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册