Merge pull request #2417 from lissyx/tflite-post_training_quantize

Use TFLite optimizations flag
This commit is contained in:
lissyx 2019-10-09 14:55:32 +02:00 committed by GitHub
commit 3026d8706b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -828,7 +828,7 @@ def export():
output_tflite_path = os.path.join(FLAGS.export_dir, output_filename.replace('.pb', '.tflite')) output_tflite_path = os.path.join(FLAGS.export_dir, output_filename.replace('.pb', '.tflite'))
converter = tf.lite.TFLiteConverter(frozen_graph, input_tensors=inputs.values(), output_tensors=outputs.values()) converter = tf.lite.TFLiteConverter(frozen_graph, input_tensors=inputs.values(), output_tensors=outputs.values())
converter.post_training_quantize = True converter.optimizations = [ tf.lite.Optimize.DEFAULT ]
# AudioSpectrogram and Mfcc ops are custom but have built-in kernels in TFLite # AudioSpectrogram and Mfcc ops are custom but have built-in kernels in TFLite
converter.allow_custom_ops = True converter.allow_custom_ops = True
tflite_model = converter.convert() tflite_model = converter.convert()