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

Add is_floating_point and div_ PyTorch ops #7128

Merged
merged 5 commits into from
Dec 18, 2020

Conversation

TylerADavis
Copy link
Contributor

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.

This PR adds support for the is_floating_point and div_ PyTorch operations, and closes #6239 .

This PR does not include a unit test for div_ as there is currently no unit test for div, and they share an implementation. Additionally, while I wrote a unit test for is_floating_point() (see https://github.com/apache/tvm/compare/main...TylerADavis:tyler_add_ops_incl_tests?expand=1), it is not included in this PR as models consisting solely of is_floating_point are compiled to constant graphs with no inputs, and the current testing infrastructure assumes that all graphs have inputs. The unit test for is_floating_point() tests the operator with torch.jit.script and torch.jit.trace with inputs consisting of int8, float64, float32, and float16. Each of these test cases passes.

@masahi
Copy link
Member

masahi commented Dec 18, 2020

Thanks, please run black to fix formatting.

@TylerADavis
Copy link
Contributor Author

Hi, I just ran black on pytorch.py and pushed the changes.

@masahi
Copy link
Member

masahi commented Dec 18, 2020

Have you looked at verify_script_model in pytorch/test_forward.py? It might help for adding tests for is_floating_point. I also encountered an empty graph when writing a test for torch.numel with tracing. See test_numel() for its usage.

@masahi masahi merged commit 833f238 into apache:main Dec 18, 2020
@masahi
Copy link
Member

masahi commented Dec 18, 2020

Thanks @TylerADavis

TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
* Add div_ and is_floating_point operators

* Add handling of exprs to op, update tests

* Revert changes to tests

* reintroduce newline

* Fix style
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
* Add div_ and is_floating_point operators

* Add handling of exprs to op, update tests

* Revert changes to tests

* reintroduce newline

* Fix style
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* Add div_ and is_floating_point operators

* Add handling of exprs to op, update tests

* Revert changes to tests

* reintroduce newline

* Fix style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants