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

[Frontend][Pytorch] Handle case where output of model is python list #7088

Merged
merged 1 commit into from Dec 11, 2020

Conversation

trevor-m
Copy link
Contributor

prim::ListConstruct converter can make a regular python list when the list is not dynamic:
https://github.com/apache/tvm/blob/main/python/tvm/relay/frontend/pytorch.py#L2436-L2439

If that python list happens to be the output of the whole model, an error would occur when the list is passed to _analysis.free_vars because it only accepts Expr. This PR puts the list in a tuple to solve that.

Copy link
Member

@masahi masahi left a comment

Choose a reason for hiding this comment

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

@trevor-m Yes, we haven't supported list output because it is not clear what output users would expect from our frontend. They definitely don't want a List ADT. Returning a python list is also wrong since Relay doesn't ingest it.

If the number of output elements is fixed, users should have used tuple instead of list in their model definition. But this fix is also good.

@masahi masahi merged commit df5ba51 into apache:main Dec 11, 2020
@masahi
Copy link
Member

masahi commented Dec 11, 2020

thanks @trevor-m @TusharKanekiDey

TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
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.

None yet

3 participants