Implement NonZero shape inference#3364
Conversation
Signed-off-by: impactaky <impactaky@users.noreply.github.com>
Signed-off-by: impactaky <impactaky@users.noreply.github.com>
aabebe1 to
081997f
Compare
|
This seems similar to #3207 ... but has extra test-cases, so makes sense to pick this one. The other one also has some signoff issues preventing a merge. |
…ence Signed-off-by: impactaky <impactaky@users.noreply.github.com>
|
Thank you! |
Signed-off-by: impactaky <impactaky@users.noreply.github.com>
552f1bb to
35e789c
Compare
|
running some validations as part of the release validation work... will check this in a few |
| const TensorShapeProto& input_shape = getInputShape(ctx, 0); | ||
| dim->set_dim_value(input_shape.dim_size()); | ||
| } | ||
| output_shape.add_dim(); |
There was a problem hiding this comment.
is this additional call to add_dim() necessary?
On line 2697 first occurrence of output_shape.add_dim()
There was a problem hiding this comment.
Yes, the output rank should be 2 as written in test, so call add_dim function twice.
There was a problem hiding this comment.
The shape of non zero op is [rank of input, num of non zero indices] hence the 2 calls to add_dim
| const TensorShapeProto& input_shape = getInputShape(ctx, 0); | ||
| dim->set_dim_value(input_shape.dim_size()); | ||
| } | ||
| output_shape.add_dim(); |
There was a problem hiding this comment.
Thank you for explaining @impactaky and @askhade ! Perhaps add the above explanation as a comment :-)
|
What is the policy in project ONNX on branches out-of-da†e, this is of†en in busy projects. https://github.community/t/requiring-up-to-date-branches-in-a-busy-repo/1550/2 |
* Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>
* Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com> Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
* [Shape inference] Always set the output of Shape to be rank-1 (#3394) * [Shape inference] Always set the output of Shape to have rank-1. Even when the input shape is unavailable, the output of Shape will always be a rank-1 vector. Signed-off-by: Derek Murray <demurra@microsoft.com> * Apply fix to Shape-1 as well. Signed-off-by: Derek Murray <demurra@microsoft.com> Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * Implement NonZero shape inference (#3364) * Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com> Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * bump version number Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Co-authored-by: Derek Murray <derek.murray@gmail.com> Co-authored-by: impactaky <37619203+impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>
* Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>
* Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com> Signed-off-by: neginraoof <neginmr@utexas.edu>
This reverts commit 7dcab62.
* Correct broken test url in ONNX Release doc (#3387) * fix broken url Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * change with valid url Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Implement NonZero shape inference (#3364) * Implement NonZero shape inference Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add shape inference code to NonZero-9 Signed-off-by: impactaky <impactaky@users.noreply.github.com> * Add type annotation Signed-off-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Adding optional type Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix broken link to logo image. (#3405) Signed-off-by: Ewa21 <ewa.tusien@intel.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Adding helper and helper tests Signed-off-by: neginraoof <neginmr@utexas.edu> * Adding numpy helper and tests Signed-off-by: neginraoof <neginmr@utexas.edu> * Update BatchNorm to specify population variance (#3402) * Specify population variance Signed-off-by: neginraoof <neginmr@utexas.edu> * Test file Signed-off-by: neginraoof <neginmr@utexas.edu> * Doc update Signed-off-by: neginraoof <neginmr@utexas.edu> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Add new type constrains for variance and mean in BatchNorm (#3415) * update def.cc first Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * update docs Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * drop but Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix Batchnorm type inference for mean and variance and add a test (#3432) * fix batchnorm type inference and add a test Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * sync X, scale and b as same type Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix url to logo image. (#3421) Signed-off-by: Ewa21 <ewa.tusien@intel.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Clarify CONTRIBUTING.md documentation generation steps (#3443) * Clarify document generation steps Signed-off-by: Dwayne Robinson <dwayner@microsoft.com> * Add note about stat_coverage.py, which is undocumented but also essential for the checkin to succeed Signed-off-by: Dwayne Robinson <dwayner@microsoft.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Add more automated verification for release packages (#3401) * windows first: test ORT, tensorflow-onnx, numpy, protobuf Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * git clone tensorflow-onnx Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * do not verify tensorflow on x86 Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * remove tensorflow-onnx verification; apply it on Linux and Mac Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * trigger Linux and Mac Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * not cd onnx Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * correct onnx path Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * correct command path Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * update right wheel name Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * remove main trigger before merge Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix ort failure in CI and add manually trigger (#3444) * fix ort failure and add manually trigger Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Merging release 1.9.0 branch into master (#3445) * Merge release 1.9.0 branch into master Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * [Dup] Update spec for Convtranspose to make it sync (#3440) * update documents Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for comments part 1 Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for reviews round 2 Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for comments part 3 Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix merge Signed-off-by: neginraoof <neginmr@utexas.edu> * Typo Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for tests part 1 Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix tests part 2 Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix tests part 3 Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Serialization changes Signed-off-by: neginraoof <neginmr@utexas.edu> * Add Additional bfloat16 Support to Pow (#3412) * Add bfloat16 to Pow 2nd argument and bump to v15 Signed-off-by: Ian Bearman <ianb@microsoft.com> * update docs Signed-off-by: Ian Bearman <ianb@microsoft.com> Co-authored-by: G. Ramalingam <grama@microsoft.com> Signed-off-by: neginraoof <neginmr@utexas.edu> * Typo Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix checker Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * make_optional_value_info Signed-off-by: neginraoof <neginmr@utexas.edu> * fix comments Signed-off-by: neginraoof <neginmr@utexas.edu> * fix 'types' in optional proto Signed-off-by: neginraoof <neginmr@utexas.edu> * fix for helper Signed-off-by: neginraoof <neginmr@utexas.edu> * flake8 Signed-off-by: neginraoof <neginmr@utexas.edu> * Removed dtype list Signed-off-by: neginraoof <neginmr@utexas.edu> * Adding test for make_optional sequence Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Added comments Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for comments Signed-off-by: neginraoof <neginmr@utexas.edu> Fix GitHub Action release CI failure: remove sudo ldconfig (#3485) * no sudo Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * remove in azurepipeline as well Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * only keep sudo make install in azurepipelines Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * add ldconfig back Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * remove ldconfig Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Fix helper Signed-off-by: neginraoof <neginmr@utexas.edu> Fix for helpers Signed-off-by: neginraoof <neginmr@utexas.edu> Signed-off-by: neginraoof <neginmr@utexas.edu> Fix tests Signed-off-by: neginraoof <neginmr@utexas.edu> Test types Signed-off-by: neginraoof <neginmr@utexas.edu> Fix for feedback Signed-off-by: neginraoof <neginmr@utexas.edu> add PR template (#3492) Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Add a PR label to manually trigger release CIs (#3470) * trigger either by rel- branch or tag Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * use another jobs Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * apply to all CIs Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * PR on Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * consider other events to trigger CI Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> * use base_ref to get branch name Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Make the version converter recurse into subgraphs (#3474) * Factor graph conversion in a separate method Signed-off-by: Matteo Salvarezza <matteo.salvarezza@gmail.com> * Recursively convert subgraph attributes Signed-off-by: Matteo Salvarezza <matteo.salvarezza@gmail.com> * Added test Signed-off-by: Matteo Salvarezza <matteo.salvarezza@gmail.com> * Lint Fixes Signed-off-by: Matteo Salvarezza <matteo.salvarezza@gmail.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Fix misleading global pooling test-case code (#3472) * Fix test-case globalaveragepool.py While the current code happens to be correct for 2d inputs, because `spatial_shape` happens to equal 2, it is incorrect for inputs that are 3d or greater. Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * Fix test-case for globalmaxpool.py While the current code happens to be correct for 2d inputs, because `spatial_shape` happens to equal 2, it is incorrect for inputs that are 3d or greater. Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * keepdims=True to eliminate spatial_shape and avoid expand_dims Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * update Operators.md Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * update TestCoverage.md Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * update Operators.md Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> * update TestCoverage.md Signed-off-by: Calvin McCarter <77687912+calvinmccarter-at-lightmatter@users.noreply.github.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com> Add missing sparse tensor helpers (#3498) * Python API Overview: minor improvements for clarity (#3446) Also use repo-relative links so that they'll work as expected locally or in a branch. Signed-off-by: Gary Miguel <garymiguel@microsoft.com> * Make sure sparse attribute cases for get are covered. Add tests. Signed-off-by: Dmitri Smirnov <dmitrism@microsoft.com> * Add make_sparse_tensor_value_info along with the test. Signed-off-by: Dmitri Smirnov <dmitrism@microsoft.com> * Fix a typo. Signed-off-by: Dmitri Smirnov <dmitrism@microsoft.com> Co-authored-by: Gary Miguel <garymiguel@microsoft.com> Merge sparse tensor Signed-off-by: neginraoof <neginmr@utexas.edu> Types Signed-off-by: neginraoof <neginmr@utexas.edu> Rename make_sequence_value_info Signed-off-by: neginraoof <neginmr@utexas.edu> Signed-off-by: neginraoof <neginmr@utexas.edu> * Signed-off-by: neginraoof <neginmr@utexas.edu> * Fix for numpy_helper comments Signed-off-by: neginraoof <neginmr@utexas.edu> * Fixing some helper comments Signed-off-by: neginraoof <neginmr@utexas.edu> * fix for comments Signed-off-by: neginraoof <neginmr@utexas.edu> * fix for comments Signed-off-by: neginraoof <neginmr@utexas.edu> * fix for comments Signed-off-by: neginraoof <neginmr@utexas.edu> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com> Co-authored-by: impactaky <37619203+impactaky@users.noreply.github.com> Co-authored-by: impactaky <impactaky@users.noreply.github.com> Co-authored-by: Ashwini Khade <askhade@microsoft.com> Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com> Co-authored-by: Ewa Tusień <ewa.tusien@intel.com> Co-authored-by: Dwayne Robinson <dwayner@microsoft.com> Co-authored-by: Ian Bearman <ian.bearman@live.com> Co-authored-by: G. Ramalingam <grama@microsoft.com>
No description provided.