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

Fix pytorch axis #14930

Merged
merged 83 commits into from
May 25, 2023
Merged

Fix pytorch axis #14930

merged 83 commits into from
May 25, 2023

Conversation

mikeseven
Copy link
Contributor

@mikeseven mikeseven commented May 23, 2023

relay.frontend.from_pytorch maps torch.squeeze() using 1 axis while pytorch allows multiple axis.
This fixes that.
Note that this pattern seems to be used for other functions. This frontend may need to be updated elsewhere. I only tested for squeeze for my current needs.

cc @areusch

Mikael Sevenier added 30 commits March 18, 2020 19:30
# Conflicts:
#	python/tvm/relay/frontend/tensorflow.py
@tvm-bot
Copy link
Collaborator

tvm-bot commented May 23, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to auto-tag found, no teams are specified in PR title See #10317 for details

Generated by tvm-bot

@github-actions github-actions bot requested a review from areusch May 24, 2023 01:38
Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

Please add a unit test for your changes.

@@ -399,7 +399,10 @@ def squeeze(self, inputs, input_types):
axis = None
else:
# TODO (t-vi): why is the cast to int needed? similarly elsewhere
axis = [int(inputs[1])]
# [MBS] squeeze axis can be a list
# axis = [int(inputs[1])]
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably the old code can be removed?

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, removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test added with other tests for this frontend.

@echuraev echuraev merged commit bcf7abb into apache:main May 25, 2023
mei-ye pushed a commit to mei-ye/tvm that referenced this pull request Jun 1, 2023
* fix conv transpose import from TF

* fix String::fromwe() to String::from()

* torch squeeze can use a list of axis

* added test for squeeze with multiple axis (pytorch 2)

* clean old code

* code without reformating

---------

Co-authored-by: Mikael Sevenier <mikael.sevenier@sima.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants