解决‘tf.ResizeNearestNeighbor‘ op is neither a custom op nor a flex op
解決'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op
將tensorflow模型轉換為TFlite模型:參考我的博客https://panjinquan.blog.csdn.net/article/details/107231435?,其中可能會出現轉換錯誤:
'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op
<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag): ResizeNearestNeighbor.
?自從Tensorflow更新到2.0后,我就發現幾乎每個版本的都有細微的差異問題,出現這個錯誤,可能是由于的網絡層添加UpSampling2D這些上采樣層,但TFlite是支持UpSampling2D操作的.
我可以很負責任的告訴你,TFlite是支持UpSampling2D,在TF2.0下支持float16量化,但不支持int8量化.不能轉的原因可能是訓練模型的版本,跟你測試的版本不一致導致的,比如當你用TF2.0進行模型訓練時,在TF2.2進行TFlite轉換,就可能出現這個錯誤,你需要保證訓練和轉換TFLite的版本一致即可
最近測試,發現TF升級到最新的TF2.3,完美解決
pip install tensorflow-gpu==2.3.0
總結
以上是生活随笔為你收集整理的解决‘tf.ResizeNearestNeighbor‘ op is neither a custom op nor a flex op的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Tensorflow2.0(Keras)
- 下一篇: 解决Ubuntu Pycharm无法输入