-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Cumulative Product Operator #7075
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
Conversation
* added and registered documenation for cumulative product operator contract * added a reference implementation of cumulative product similar to cumulative summation * added unit tests for cumulative product operations Signed-off-by: Clay Elmore <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7075 +/- ##
==========================================
- Coverage 56.40% 56.20% -0.21%
==========================================
Files 510 512 +2
Lines 32721 32821 +100
Branches 3093 3099 +6
==========================================
- Hits 18457 18446 -11
- Misses 13410 13517 +107
- Partials 854 858 +4 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Clay Elmore <[email protected]>
Signed-off-by: Clay Elmore <[email protected]>
|
Related to the request in #6590 |
|
@onnx/sig-operators-approvers |
|
Thank you! I think we can wait for #7030 to setup opset24 as this operator will need to be included in a new opset (24) |
|
@celmore25 could you merge from main and move the operator to opset 24? Thank you |
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.
It would be great to push this over the finish line. Could you add some tests please?
| .TypeConstraint( | ||
| "T", | ||
| OpSchema::numeric_types_for_math_reduction_ir4(), | ||
| "Constrain input and output types to high-precision numeric tensors.") |
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.
Nit: I'd say that float16 is not "high-precision".
|
@celmore25 Hi! We have a branch cut by the end of this month. It would be great if we can merge this change before then. Did you get a chance to take a look at the comments? Thanks! |
|
@celmore25 would you like to rebase from main? Thank you |
|
@justinchuby @celmore25 We can make this in 1.20. |
|
@titaiwangms i can work with you to get this in. Maybe in a week |
Cumulative Product Operator
Description of the Operator
The cumulative product operator
cumprodperforms cumulative product of the input elements along the given axis. By default, it will do the product inclusively meaning the first element is copied as is. Through anexclusiveattribute, this behavior can change to exclude the first element. It can also perform product in the opposite direction of the axis. For that, setreverseattribute to 1. Note, the behavior of thecumprodoperator is built to mirror exactly what the existing cumulative sum operatorcumsumdoes as of operator version 14.The documentation of the existing
cumprodoperator in NumPy is available here.Example:
Reference Implementation
The implemenation below provides a simple example of how to use the
CumProdoperator in ONNX. It creates a single node model with aCumProdnode and saves it to a file. It then creates a reference evaluator for the model and runs inference on it. It compares the output of the model with the output of the NumPycumprodfunction.