未验证 提交 8585279f 编写于 作者: Z zhupengyang 提交者: GitHub

fix scale pass when "conditional_block" or "while" is before "scale" (#43323)

上级 46c04c8f
...@@ -34,7 +34,16 @@ void IdentityScaleOpCleanPass::ApplyImpl(ir::Graph* graph) const { ...@@ -34,7 +34,16 @@ void IdentityScaleOpCleanPass::ApplyImpl(ir::Graph* graph) const {
detector.mutable_pattern() detector.mutable_pattern()
->NewNode("scale_in") ->NewNode("scale_in")
->assert_is_op_input("scale") ->assert_is_op_input("scale")
->assert_more([](Node* x) { return x->outputs.size() == 1UL; }); ->assert_has_n_outputs(1)
->assert_more([](Node* x) {
for (auto* op : x->inputs) {
auto op_type = op->Op()->Type();
if (op_type == "conditional_block" || op_type == "while") {
return false;
}
}
return true;
});
auto scale_op = detector.mutable_pattern() auto scale_op = detector.mutable_pattern()
->NewNode("scale_fuse") ->NewNode("scale_fuse")
->assert_is_op("scale") ->assert_is_op("scale")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册