-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add Split-18 - num_outputs attribute, support for uneven tensor splitting #4481
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
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
LGTM, thanks! Just one minor comment above to clarify shapes for the zero-size tensor. |
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
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.
Perhaps you can try to cherry-pick this PR: #4202 and see whether it helps to show the exact errors without seg fault.
If that PR is indeed helpful, I would say we should forward that PR for better debugging.
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.
Sorry, I think my PR #4202 now needs a few updates for being compatible with #4470. We can try another way: to faster test the unknown failure in your local, perhaps you can try:
python setup.py install # build ONNX with your PR
python onnx/backend/test/cmd_tools.py generate-data
git diff --exit-code --diff-filter=ADR -- . :!onnx/onnx-data.proto
I suspect the number of input_.pb or output_.pb might be incorrect in your PR. If that is true, the commands above should show some files. If not, there might be other issues I don't know in input_.pb or output_.pb.
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
270c70e
to
c82a9bb
Compare
@jcwchen I ran the commands, they did not show any files. However, after removing |
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.
I might figure out why previous CI has failed: some added test model files are not needed. I don't see where they are generated. For instance, test_uneven_split
and test_uneven_split_opset18
. I would suggest you clean all of added test files and then use python onnx/backend/test/cmd_tools.py generate-data
to generated them again. Since related test was just removed due to recent ONNXIFI deprecation, I will add a similar check in CI to prevent future issues like it.
Another suggestion would be making test files naming convention consistent. For names of Split related tests, please use test_split_XXX_XXX
. IMO, it will be helpful for users to search related test files.
FYI: to detect similar issue (introducing new node test directories without corresponding test script) I mentioned above, I added a CI check for it by this PR: #4514. |
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
This reverts commit ea7621f. Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
@jcwchen I applied your suggestions, thanks! For some reason I assumed that script that generates data also removes the old files. I also approved your PR introducing a CI check for that, it sounds helpful. Test names also have been aligned. |
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.
Thank you for the updates! Once you have updated TestCoverage.md
by the updated test scripts , I think this PR is ready to go.
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
I think it would be helpful to update the |
Or, may be the test-case generator should delete the folder? (Of course, it could be a bit risky in case the user has some other file there ... may be warn the user if there is some extra files there perhaps.) |
static const char* Split_ver18_doc = | ||
R"DOC(Split a tensor into a list of tensors, along the specified 'axis'. | ||
Either input 'split' or the attribute 'num_outputs' should be specified, but not both. | ||
If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts. |
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.
Need to update above line by adding the line from below If the tensor is not evenly splittable, the last chunk will be smaller.
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.
Good catch, done.
Sounds good. I will add sentence about it in AddNewOp.md in this PR as well: #4514. Also note that that PR will let CI to catch this kind of issue. Perhaps we can forward that PR first and have that verify this PR.
Yes, but it seems possible that users would like to keep existing ones for some testing purposes? Therefore, to keep behavior consistent, I introduced --clean flag for generate_data for CI use (by default it is False so it won't clean original node directory automatically). |
Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
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 passed the enhanced CI 💯 Thank you @p-wysocki for this PR and waiting! I will merge it soon.
…ting (onnx#4481) * Add Split-18 Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Uneven split works for 1d Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Add Nd support and tests Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Update docs Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Minor change Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Apply linter changes Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Fix linter, add CR changes Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Apply black changes Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Update docs Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Update test files Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Revert "Update test files" This reverts commit ea7621f. Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Update test files Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Align test names Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * update docs Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> * Add info about uneven split Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com>
Description
num_outputs
attributeMotivation and Context
Split
even when dimension is not evenly splittable #4438Previously discussed in #4389