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

[ONNX] [Relay] Update unique operator to match ONNX output (1D only) #8099

Merged
merged 26 commits into from
Jun 1, 2021

Conversation

electriclilies
Copy link
Contributor

@electriclilies electriclilies commented May 21, 2021

The unique operator in TVM did not match the ONNX output. In this PR, I make changes to Unique so that the 1D ONNX unit tests passes. The changes are:

  • Correcting the documentation and order of return values in Relay code, topi code and in testing code. The documentation currently says that TVM's unique op returns indices, which is

    "A 1-D tensor. The same size as output. For each entry in output, it contains the index of its first occurance in the input data. The end of the tensor is padded with the length of the input data".

    However, the op was actually returning inverse_indices, which is:

    "A 1-D tensor. For each entry in data, it contains the index of that data element in the unique array."

    To fix this, I renamed indices as inverse_indices and updated the documentation accordingly.

  • Adding indices (the correct version) as an output to Unique

  • Adding Unique to the ONNX importer

  • Fixing a bug in the ONNX importer which caused ops with multiple optional outputs to not import

@mbrookhart Please take a look!

@tqchen
Copy link
Member

tqchen commented Jun 1, 2021

@mbrookhart please help to manage this PR

Copy link
Contributor

@mbrookhart mbrookhart left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @electriclilies @tqchen

@mbrookhart mbrookhart merged commit 6baccc1 into apache:main Jun 1, 2021
@mbrookhart mbrookhart deleted the onnx_unique_1d branch June 1, 2021 17:31
@electriclilies
Copy link
Contributor Author

Thanks @mbrookhart!

mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Jun 3, 2021
…pache#8099)

* Fix topi test case and docs (tvm was returning inverse_indices and claiming it was indices)

* Passes on CPU, fix unique op test

* more changes

* mtrying to fix optional outputs in onnx importer

* TupleGetItem is being passed a stringgit add python/tvm/relay/frontend/onnx.py debugging print statements

* Unique is passing onnx unit tests

* fix indices

* change comment

* fix return of compute unique

* black

* fix lint

* Some stray .asnumpy()s got through my merge, fix)

* fix lint

* revert changed .numpys

* missed a few

* fix more .asnumpy

* fix black

* Fix op level 3 test

* remove prints

* Fix pytorch and tf importers

* black

* fix lint

* fix indentation

* fix topi test
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 17, 2021
…pache#8099)

* Fix topi test case and docs (tvm was returning inverse_indices and claiming it was indices)

* Passes on CPU, fix unique op test

* more changes

* mtrying to fix optional outputs in onnx importer

* TupleGetItem is being passed a stringgit add python/tvm/relay/frontend/onnx.py debugging print statements

* Unique is passing onnx unit tests

* fix indices

* change comment

* fix return of compute unique

* black

* fix lint

* Some stray .asnumpy()s got through my merge, fix)

* fix lint

* revert changed .numpys

* missed a few

* fix more .asnumpy

* fix black

* Fix op level 3 test

* remove prints

* Fix pytorch and tf importers

* black

* fix lint

* fix indentation

* fix topi test
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 17, 2021
…pache#8099)

* Fix topi test case and docs (tvm was returning inverse_indices and claiming it was indices)

* Passes on CPU, fix unique op test

* more changes

* mtrying to fix optional outputs in onnx importer

* TupleGetItem is being passed a stringgit add python/tvm/relay/frontend/onnx.py debugging print statements

* Unique is passing onnx unit tests

* fix indices

* change comment

* fix return of compute unique

* black

* fix lint

* Some stray .asnumpy()s got through my merge, fix)

* fix lint

* revert changed .numpys

* missed a few

* fix more .asnumpy

* fix black

* Fix op level 3 test

* remove prints

* Fix pytorch and tf importers

* black

* fix lint

* fix indentation

* fix topi test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants