Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PASS]fix conv_elementwise_tree_fuse_pass rm bug #6812

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

daming5432
Copy link
Collaborator

@daming5432 daming5432 commented Aug 31, 2021

【问题1】
在该 pass 中,需要限制 conv1x1 的输出 VarNode 只能有一个输出。当该 VarNode 有多个输出时,由于该 VarNode 被标记为了AsIntermediate,进而该 VarNode 被删除,导致该与该 VarNode 有连接关系的节点出现输入悬空状态,因此这时经 opt 转换输出的模型结构会出现问题。在 EfficientNetB0 模型上可以复现这个问题。

【解决方法】
对 conv1x1 的输出 VarNode 加上assert_only_one_output限制。

【效果】
可解决 EfficientNetB0 模型转换问题。

【问题2】
在对 HRNet_W18_C 模型进行 opt 转换时,图结果异常:有 5 个匹配 pattern,正常应该删除15个中间节点,但是删除了 39 个中间节点。

【解决方法】
该pass中将删除节点的操作从父类迁移到子类,删除节点操作不再依赖AsIntermediate()标记。

【效果】
可解决 HRNet_W18_C 模型转换问题。

@paddle-bot-old
Copy link

Thanks for your contribution!

@@ -146,9 +150,9 @@ void ConvElementwiseTreeFuser::InsertNewNode(SSAGraph* graph,
}

// NOTE: Mark these node as intermediate at this place.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的NOTE同步也修改下吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -48,6 +60,7 @@ class ConvElementwiseTreeFuser : public FuseBase {
PMNode* conv_output_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这三个PMNode*类型的成员变量可以去掉,改为临时变量。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Collaborator

@zhaoyang-star zhaoyang-star left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2个comments

Copy link
Collaborator

@zhaoyang-star zhaoyang-star left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daming5432 daming5432 merged commit 0844db0 into PaddlePaddle:develop Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants