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][Keras] Make keras reshape less restrictive #7446

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

trevor-m
Copy link
Contributor

The previous implementation of reshape in the Keras frontend attempted to map the target shape, which is specified in NHWC format, to NCHW format. However, this approach had many limitations of what reshapes can be supported and introduced some complicated logic.

Instead, I am proposing to just transpose input to NHWC, apply the unmodified reshape, then transpose back to NCHW. This is simpler and can support more reshapes which are valid in keras.

I added some test cases for reshapes which were not supported in the previous implementation, but are now possible.

@trevor-m
Copy link
Contributor Author

@siju-samuel @jwfromm @mbrookhart Could you please review?

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.

@masahi masahi merged commit a1260cc into apache:main Feb 12, 2021
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 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.

3 participants