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

Add check for float32 in IsBinaryTensor #642

Merged
merged 1 commit into from
May 19, 2021
Merged

Conversation

Tombana
Copy link
Collaborator

@Tombana Tombana commented May 14, 2021

What do these changes do?

When we try to convert a float16 model, the MLIR converter crashes in IsBinaryTensor which assumes the type is float32.
With this fix, float16 models will still fail to convert but that's due to tensorflow not supporting it: it causes an assertion failure somewhere in a pattern in prepare_tf.cc.

Alternatively we could try to support bitpacking float16. I did not see a simple way of automatically getting float32 values from a float16 DenseElementsAttr, so I think that in order to support that we'd have to explicitly have if ( float16 ) { ... } blocks in the code here and also in several other functions that access the filter data (the bitpacking functions).

In any case that won't help us yet since the non-bconv parts of the network will still crash in the tensorflow part of the code.

How Has This Been Tested?

Tested on a float16 model: still crashes but in TF code and not in our code.

Related issue number

@lgeiger already commented on a TF issue about this long ago: tensorflow/tensorflow#46380

@Tombana Tombana requested a review from lgeiger May 14, 2021 13:28
Copy link
Member

@lgeiger lgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Good catch!

@lgeiger lgeiger merged commit 6a50efd into master May 19, 2021
@lgeiger lgeiger deleted the converter_f32_check branch May 19, 2021 15:19
@lgeiger lgeiger added the internal-improvement Internal Improvements and Maintenance label May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-improvement Internal Improvements and Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants