-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Bugfix][Relay][Frontend][Keras] Add a assertion to reject a invalid value for attribute units in RNN layers #15334
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
Conversation
Capture the invalid value of units.
|
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. Generated by tvm-bot |
echuraev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general LGTM. I have some doubts. How did these models with incorrect units number work in old versions of Keras? I'm afraid that we can break a backward compatibility by this patch. Probably we could process this units number in the way how it was implemented in Keras? Or we can check Keras version and generate assert for newer versions of Keras. What do you think?
|
@echuraev Thanks for your comments! If In the new version of Keras, the called statement |
|
BTW, in addition to LSTM, RNN, and GRU, the Dense has the same bug. Thus we added an extra patch to fix |
|
@tvm-bot rerun |
echuraev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for clarification. LGTM.
|
Thanks for the fixing! |

This PR fixes two types of bugs:
Bug 1. fix a typo about the wrong API name in the test case.
Bug 2-5. add an assertion to reject the invalid model, which can be constructed in the old version of Keras. The attribute
unitsin LSTM, RNN, GRU, and Dense must have a positive value. Such invalid values can be used to construct a DL model successfully and can be converted to RelayIR successfully. In this pr, we reject these invalid models containing such layers.Steps to reproduce to bug-2 about LSTM: (Keras <= 2.6)
In the latest version of Keras, the invalid value for units will be rejected. Thus, the test case can be triggered using the Keras <=2.4.
Thus, we cannot new test cases into the unit tests.
cc @echuraev @leandron