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

[Executor][Bugfix] Properly return and unflatten outputs from GraphExecutor #7604

Merged
merged 6 commits into from
Mar 6, 2021

Conversation

altanh
Copy link
Contributor

@altanh altanh commented Mar 6, 2021

Previously, if a graph module returned nested tuples (which end up being flattened per #6809), the GraphExecutor would not unflatten the result and instead naively returned only the first k of the flattened outputs (where k = original top-level tuple size). This PR fixes the output behavior of GraphExecutor to be the same as the VMExecutor ,by returning the outputs unflattened into nested lists respecting the original return type structure.

cc @masahi @jroesch

I'm not super happy with the unflattening code, let me know if there's an easier/cleaner approach.
Edit: I think it's clean enough now

@masahi masahi self-assigned this Mar 6, 2021
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.

Interesting recursion + iteration.

@masahi masahi merged commit 875f8ee into apache:main Mar 6, 2021
@masahi
Copy link
Member

masahi commented Mar 6, 2021

thanks @altanh

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…ecutor (apache#7604)

* properly return and unflatten outputs from GraphExecutor

* lint

* cleaner approach, not sure what I was thinking before

* remove unused import

* forgot copyto cpu

* make solution even cleaner using iterator
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
…ecutor (apache#7604)

* properly return and unflatten outputs from GraphExecutor

* lint

* cleaner approach, not sure what I was thinking before

* remove unused import

* forgot copyto cpu

* make solution even cleaner using iterator
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.

2 participants