attempting to use a delegate that only supports static-sized tensors
Opened this issue · 5 comments
我在運作tflite模型的時候,會出現
ERROR : attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-size tensors.
請問要如何知道模型是否有使用到dynamic-size tensors,或是能否將dynamic-size tensors固定成static-sized tensors,我使用的模形是tiny_yolo3_shufflenetv2
我使用tool/model_converter/custom_tflite_convert.py 將keras model 轉成tflite model
python3 custom_tflite_convert.py --keras_model_file model.h5 --output_file model.tflite
@david8862 我是在i.mx8m plus上使用上面的模型去跑TFLite,才造成上述的問題,然後使用的模型是透過TF2將Keras模型轉成TFLite模型。
後來我嘗試使用TF1將Keras模型轉成TFLite後,就可以正常在i.mx8m plus上執行。
我在Netron比較TF1和TF2分別轉換出來的模型,發現應該是Shape造成dynamic-size tensors的問題
@david8862 我想要在TF2中使用tools/model_converter/post_train_quant_convert.py,將我的模型量化,並且不使用Shape這個op,請問有辦法作到嗎?
这个应该很难。TF -> TFLite的op转换方式主要由TF framework控制,且不同TF版本之间的差别也很大。training code中基本没法控制