Skip to content

Single layer Keras LSTM converted to loop instead of ONNX LSTM op #1851

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

Open
JonTriebenbach opened this issue Feb 15, 2022 · 7 comments
Open
Assignees
Labels
keras Issues related to Keras potential bug Error in codebase may cause a bug, but no concrete examples observed

Comments

@JonTriebenbach
Copy link

The attached example shows a Keras model with a single layer LSTM that is converted to a loop instead of the expected ONNX LSTM op.

Test system configuration:
Using tensorflow/tensorflow:2.7.1 docker image:

tensorflow-cpu               2.7.1
tf2onnx                      1.10.0

This issue appears to be similar to tf.keras.layers.LSTM not converted to ONNX LSTM layer #1546 with pull request Add Keras LSTM support .

onnx_issue.zip

Please review this issue. Thanks.

@ahallermed
Copy link

@JonTriebenbach I had the same issue with tensorflow==2.7.0 and tf2onnx==1.9.2.

A simple upgrade from to tf2onnx==1.9.3 solved the issue, that lstms are shown as loops. At least for me.

@hwangdeyu
Copy link
Contributor

This PR Add Keras LSTM support involved in tf2onnx verison == 1.9.3.
So This issue should be fixed after tf2onnx == 1.9.3 theoretically.
I also tried to test it in tensorflow==2.7.1 and tfonnx == 1.9.3/1.10.0, and the lstms are both LSTM op instand of loop..
image
Could you check it again? Thanks.

@hwangdeyu hwangdeyu self-assigned this Feb 17, 2022
@JonTriebenbach
Copy link
Author

@hwangdeyu Yes, we have other LSTM models that now convert as expected with tf2onnx 1.9.3. Thank you for those fixes that corrected those other models. The problem is that this new model is not converting as expected. The problem shows on both 1.9.3, and on the latest 1.10.0.

I do not know what is different about this new model that is not converting as expected. We have other models that have multiple LSTM layers, which convert as expected, this model is only a single layer LSTM model, which indicates it is not a multi-layer model issue. There is some other complexity in this new model that is causing a conversion issue.

Please continue to investigate. Thank you.

@hwangdeyu hwangdeyu added potential bug Error in codebase may cause a bug, but no concrete examples observed keras Issues related to Keras and removed need-info labels Feb 18, 2022
@mjlorenzo305
Copy link

any updates on this one?

@AndreyOrb
Copy link

Is there any progress with this issue?

@AndreyOrb
Copy link

Is there any ETA on this issue?

@fatcat-z
Copy link
Collaborator

Is there any ETA on this issue?

Not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keras Issues related to Keras potential bug Error in codebase may cause a bug, but no concrete examples observed
Projects
None yet
Development

No branches or pull requests

6 participants