-
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
[ONNX] Add CumSum operator to ONNX frontend #7391
Conversation
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.
Fix lint?
I'm a little confused, I'm looking at the ONNX spec, and I only see 2 inputs, not three. What is the third input you're using for datatype?
https://github.com/onnx/onnx/blob/master/docs/Operators.md#cumsum
We should probably either handle or error when the exclusive or reverse attributes are true.
Oh, I just noticed it's a draft :) You're probably not ready for review, sorry. |
c265b41
to
23404a0
Compare
@mbrookhart, thank you for you questions. Now I added error generation for |
It's strange ONNX |
4203af6
to
9413f7e
Compare
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.
Looking very close.
It looks like you have a bit of a hybrid approach with the two options, one you're supporting in the relay constructor, the other you support in the TOPI CPU kernel, but not the GPU kernel?
I wonder if it makes more sense to do the reverse/exclusive changes explicitly in the importer so we don't have to pipe it through the multiple layers? I'm not sure if support the attributes in topi or doing it via composition in the importer makes more sense.
I think tvm/python/tvm/topi/cuda/scan.py Line 517 in 1e0d356
exclusive=True , we can use exclusive_scan instead of inclusive_scan .
|
9413f7e
to
5e63126
Compare
@mbrookhart, @masahi, I have one question about implementation of |
I'm happy with the current implementation. It is faster, and exclusive cumsum could be useful for other purpose (just as |
* [ONNX] Add CumSum operator to ONNX frontend * Fix lint and add attributes to CumSum * Fix CumSum test * Add support exclusive attribute * Add support reverse attribute * Fix clang-format * Fix lint * Move reverse calculation to ONNX frontend and add exclusive to GPU * Add test for int type
* [ONNX] Add CumSum operator to ONNX frontend * Fix lint and add attributes to CumSum * Fix CumSum test * Add support exclusive attribute * Add support reverse attribute * Fix clang-format * Fix lint * Move reverse calculation to ONNX frontend and add exclusive to GPU * Add test for int type
* [ONNX] Add CumSum operator to ONNX frontend * Fix lint and add attributes to CumSum * Fix CumSum test * Add support exclusive attribute * Add support reverse attribute * Fix clang-format * Fix lint * Move reverse calculation to ONNX frontend and add exclusive to GPU * Add test for int type
Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.