tflite Didn't find op for builtin opcode 'STRIDED_SLICE' version '6'

Viewed 479

Hi i am trying to upload tflite to android studio but
Didn't find op for builtin opcode 'STRIDED_SLICE' version '6'
comes out. here is python code to convert .h5 file to tflite.

fastspeech_concrete_function = fastspeech2.inference_tflite.get_concrete_function()
converter = tf.lite.TFLiteConverter.from_concrete_functions(
[fastspeech_concrete_function]
)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,
                                   tf.lite.OpsSet.SELECT_TF_OPS,
                                   ]
 
tflite_model = converter.convert()

with open('fastspeech.tflite', 'wb') as f:
    f.write(tflite_model)

i added

tf.strided_slice, tf.raw_ops.StridedSlice in
converter.target_spec.supported_ops 

but didn't work how can i do?
i am using tflite verions like below

implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'

i tried with tensorflow==2.2.0 & 2.3.0 & 2.4.1

2 Answers
implementation 'org.tensorflow:tensorflow-lite:2.5.0'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT'
implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'

I solved with using those. but I am not sure that other problems will be solved with above lines.

I had this error too. It arose due to the fact that I was freezing the model through the exporter_main_v2.py file, but it was necessary through export_tflite_graph_tf2.py. To further convert it to tflite format

Related