-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Paddle Inference] add constant folding pass #45494
[Paddle Inference] add constant folding pass #45494
Conversation
…addle into constant_folding
你的PR提交成功,感谢你对开源项目的贡献! |
PADDLE_ENFORCE_NOT_NULL( | ||
graph, platform::errors::PreconditionNotMet("graph should not be null.")); | ||
FusePassBase::Init("constant_folding", graph); | ||
auto *scope = param_scope(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加nulltpr判断
for (auto out_node : op_node->outputs) { | ||
map[out_node->Name()] = 0; | ||
} | ||
// Forbide other node in graph having the same name with nodes in map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forbid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
Others
Describe
When a op's inputs and outputs is determined before feeding data to the model, we can remove this op from the model.
This ConstantFolding pass can remove all these like ops.