Skip to content
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

Implement NonZero shape inference #3364

Merged
merged 8 commits into from
Apr 5, 2021

Conversation

impactaky
Copy link
Contributor

No description provided.

Signed-off-by: impactaky <impactaky@users.noreply.github.com>
@impactaky impactaky requested review from a team as code owners March 29, 2021 16:38
@CLAassistant
Copy link

CLAassistant commented Mar 29, 2021

CLA assistant check
All committers have signed the CLA.

Signed-off-by: impactaky <impactaky@users.noreply.github.com>
@gramalingam
Copy link
Contributor

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.

@gramalingam gramalingam added the operator Issues related to ONNX operators label Mar 30, 2021
…ence

Signed-off-by: impactaky <impactaky@users.noreply.github.com>
@impactaky
Copy link
Contributor Author

Thank you!

Signed-off-by: impactaky <impactaky@users.noreply.github.com>
@askhade
Copy link
Contributor

askhade commented Mar 30, 2021

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this additional call to add_dim() necessary?
On line 2697 first occurrence of output_shape.add_dim()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the output rank should be 2 as written in test, so call add_dim function twice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, a second call to add_dim()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for explaining @impactaky and @askhade ! Perhaps add the above explanation as a comment :-)

@mkbhanda
Copy link

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

@askhade askhade merged commit aa4cab3 into onnx:master Apr 5, 2021
@askhade askhade added this to the 1.9 milestone Apr 5, 2021
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Apr 5, 2021
* 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>
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Apr 5, 2021
* 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>
jcwchen added a commit that referenced this pull request Apr 5, 2021
* [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>
etusien pushed a commit to etusien/onnx that referenced this pull request Apr 7, 2021
* 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>
neginraoof pushed a commit to neginraoof/onnx that referenced this pull request Apr 22, 2021
* 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>
neginraoof added a commit to neginraoof/onnx that referenced this pull request Apr 22, 2021
gramalingam added a commit that referenced this pull request May 28, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operator Issues related to ONNX operators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants