-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Added conv + hard_sigmoid oneDNN fuse pass #36869
Added conv + hard_sigmoid oneDNN fuse pass #36869
Conversation
Thanks for your contribution! |
@piotrekobiIntel Please, review this PR |
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, it's weird how you basically have to write the same thing in conv_activation_mkldnn_fuse_pass.cc and hard_sigmoid.pbtxt (the latter looks much cleaner), but I guess that's just the beauty of our framework :)
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
@jczaja please merge |
…e#36869) * added conv + hard_sigmoid fuse pass * Removed IsOptional() statements * Reverted removing optional
PR types
New features
PR changes
OPs
Describe
Added conv + hard_sigmoid oneDNN fuse pass. It is designed mainly for PPLCNets architectures. This fuse pass improves PPLCNet_x0_25 model performance by 3% and PPLCNet_x1_0 performance by 1.4%
OneDNN does not have pure hard_sigmoid activation, that's why 2 eltwise postops are needed.
hard_sigmoid(x, slope, offset) = max(0, min(1, slope * x + offset))
With oneDNN, we can get the inner equation by
eltwise_linear(x, slope, offset) = slope * x + offset
And adding clip after that would give us the exact equation as pure hard_sigmoid
eltwise_clip(eltwise_linear(x, slope, offset), 0, 1) = max(0, min(1, slope * x + offset))