Hello,
I’m using:
* python:3.7
* tensroflow 2.4.0
After Converting a .h5 model to .tflite,when call interpreter.allocate_tensors(),then exit execution.If I set converter.target_spec.supported_ops = [tf.lite.OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8] to converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8],it’s okcould you give me some help? Thank you very much!
The code :https://github.com/LNCC99/tensorflow-convert-test
tensorflow_convert2tflite.py
converter = tf.lite.TFLiteConverter.from_keras_model(my_model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8]
tflite_model = converter.convert()
quant_model_path = ‘./model_tflite_CTIVATIONS_INT16_WEIGHTS_INT8_InOutInt16.tflite’
with open(quant_model_path, ‘wb’) as f:
f.write(tflite_model)
interpreter = tflite.Interpreter(model_path=quant_model_path)
interpreter.allocate_tensors()