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

TFLite's max operator has wrong broadcasting behavior #57759

Closed
Co1lin opened this issue Sep 20, 2022 · 8 comments
Closed

TFLite's max operator has wrong broadcasting behavior #57759

Co1lin opened this issue Sep 20, 2022 · 8 comments
Assignees
Labels
comp:lite TF Lite related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter type:bug Bug

Comments

@Co1lin
Copy link

Co1lin commented Sep 20, 2022

1. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04.4 LTS
  • TensorFlow installation (pip package or built from source): pip package
  • TensorFlow library (version, if pip package or github SHA, if built from source): 2.11.0.dev20220914

2. Code

Provide code to help us reproduce your issues using one of the following options:

Option A: Reference colab notebooks

https://colab.research.google.com/drive/1SWl6-cWwk2zRkiNYifUXtzojSz_uUCxg?usp=sharing

Option B: Paste your code here or provide a link to a custom end-to-end colab

3. Failure after conversion

After converting to TFLite, the model produces tensor with wrong shape. This is inconsistent with normal TF runtime, and numpy behavior.

@Co1lin Co1lin added the TFLiteConverter For issues related to TFLite converter label Sep 20, 2022
@mohantym mohantym assigned mohantym and unassigned tilakrayal Sep 20, 2022
@mohantym mohantym added comp:lite TF Lite related issues type:bug Bug labels Sep 20, 2022
@mohantym
Copy link
Contributor

Hi @Co1lin !
It is replicating in nightly but It was throwing converter error in 2.9 and 2.10. As the documentation on tf.maximum suggests you should use same shapes for both input and output.

Thank you!

@mohantym mohantym added the stat:awaiting response Status - Awaiting response from author label Sep 20, 2022
@Co1lin
Copy link
Author

Co1lin commented Sep 20, 2022

Hi, thank you for the reply! Since the documentation of maximum also notes that "Note that maximum supports broadcast semantics for x and y" which means numpy style broadcasting is supported, it's better if TFLite can produce the same results as numpy and TF.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Sep 20, 2022
@mohantym
Copy link
Contributor

Ok @Co1lin !
Thanks for the clarification. It is a valid bug then.

@sachinprasadhs !
Could you look at this issue. Attached gist in 2.9, 2.10 and nightly for reference.

Thank you!

@mohantym mohantym assigned sachinprasadhs and unassigned mohantym Sep 20, 2022
@ganler
Copy link
Contributor

ganler commented Sep 24, 2022

@mohantym @sachinprasadhs It seems this bug only occurs when one of the arguments in max is tf.zeros. When setting it to tf.ones, the inferred shape will be correct.

@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Oct 26, 2022
@pkgoogle
Copy link

Hi,

Thank you for opening this issue. Since this issue has been open for a long time, the code/debug information for this issue may not be relevant with the current state of the code base.

The TFLite team is constantly improving the framework by fixing bugs and adding new features. We suggest you try the latest TensorFlow version with the latest compatible hardware configuration which could potentially resolve the issue. If you are still facing the issue, please create a new GitHub issue with your latest findings, with all the debugging information which could help us investigate.

Please follow the release notes to stay up to date with the latest developments which are happening in the TFLite space.

@pkgoogle pkgoogle added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Aug 28, 2023
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Sep 5, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite TF Lite related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter type:bug Bug
Projects
None yet
Development

No branches or pull requests

7 participants