tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
185.67k stars 74.19k forks source link

Include tf.IsInf on Tensorflow Lite Operators #60011

Open JuanuMusic opened 1 year ago

JuanuMusic commented 1 year ago

System information

Provide the text output from tflite_convert

<unknown>:0: error: failed while converting: 'main': 
Some ops in the model are custom ops, See instructions to implement custom ops: https://www.tensorflow.org/lite/guide/ops_custom 
Custom ops: IsInf
Details:
    tf.IsInf(tensor<?x21x?xf64>) -> (tensor<?x21x?xi1>) : {device = ""}
    tf.IsInf(tensor<?x33x?xf64>) -> (tensor<?x33x?xi1>) : {device = ""}

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/Jupyter/any notebook.

Also, please include a link to a GraphDef or the model if possible.

Any other info / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

synandi commented 1 year ago

Hi @JuanuMusic, As mentioned in the error, as a workaround you can create your own custom implementation of an unsupported TensorFlow operator in TensorFlow Lite, known as a custom operator by following the instructions mentioned here. Thank you!

JuanuMusic commented 1 year ago

Hi! Yes, I know, but its also suggested to open an Issue to request to add. I think it's an important operator since there are some pre-procesdsing strategies that indeed require it.