-
Notifications
You must be signed in to change notification settings - Fork 3.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
[Relay] Add support for relay expressions as pad value for static pad #7860
[Relay] Add support for relay expressions as pad value for static pad #7860
Conversation
@mbrookhart @jwfromm please add appropriate reviewers. |
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.
Overall, looks good to me -- just one comment about adding a comment :)
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
Thanks @AndrewZhaoLuo @electriclilies |
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
…apache#7860) * add support for expr as inputs to pad * fix improper amount of args * add dynamic padding test * infer type better test * add comments to type relations * fix infer type layouts * proper return shape * proper shape infer type * make the tests pass by setting the conditions * make codegen reflect reality * make ternary operations more pythonic * proper infer layout * fold explicit padding * fix pattern matching in contrib * revert tests for contrib now that pattern matching works * revert import changes * add newline
* [Relay to Onnx conversion][Pool] * added missing ceil_mode in average pool and max pool conversion * [Relay to Onnx conversion][Pad] * Fixed issue in Pad conversion: changed pad_value to input instead of attrs * Refer to PR: #7860 * Updated unit test for Pad * Fixed some formatting errors
* [Relay to Onnx conversion][Pool] * added missing ceil_mode in average pool and max pool conversion * [Relay to Onnx conversion][Pad] * Fixed issue in Pad conversion: changed pad_value to input instead of attrs * Refer to PR: apache#7860 * Updated unit test for Pad * Fixed some formatting errors
* [Relay to Onnx conversion][Pool] * added missing ceil_mode in average pool and max pool conversion * [Relay to Onnx conversion][Pad] * Fixed issue in Pad conversion: changed pad_value to input instead of attrs * Refer to PR: apache#7860 * Updated unit test for Pad * Fixed some formatting errors
This PR allow static padding to take in relay expressions for the padding value.
Previously if the padding value is an expression then dynamic padding will be performed instead even if the tensor shape cane be easily calculated based on constant padding widths. The output would be a dynamically shaped tensor which is not compatible with a lot of other operations. Now, dynamic padding is dispatched only when the pad widths themselves are expressions.
In particular this is useful for quantization work where we need to pad input tensors with an appropriate and variable zero point.