[Reland] Cumulative Product Operator#7400
Merged
titaiwangms merged 9 commits intoonnx:mainfrom Dec 16, 2025
Merged
Conversation
Contributor
Author
|
@gramalingam @justinchuby Should I register the new op under 24? I am under the impression that 1.20 is the first release that we are not introducing new opset version. |
Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7400 +/- ##
==========================================
- Coverage 55.28% 55.20% -0.08%
==========================================
Files 513 515 +2
Lines 32228 32324 +96
Branches 2895 2897 +2
==========================================
+ Hits 17816 17844 +28
- Misses 13619 13688 +69
+ Partials 793 792 -1 ☔ View full report in Codecov by Sentry. |
justinchuby
reviewed
Oct 17, 2025
Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
Comment on lines
+1916
to
+1917
| ONNX_OPERATOR_SET_SCHEMA( | ||
| CumProd, |
Check notice
Code scanning / CodeQL
Unused static variable Note
Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Credits to @celmore25 (#7075)