Skip to content

Instantly share code, notes, and snippets.

@tiandiao123
Created September 7, 2022 23:54
Show Gist options
  • Select an option

  • Save tiandiao123/c14e8e2ecd21a890ccfae47722f4f6b6 to your computer and use it in GitHub Desktop.

Select an option

Save tiandiao123/c14e8e2ecd21a890ccfae47722f4f6b6 to your computer and use it in GitHub Desktop.
import tensorflow as tf
saved_model_dir = "/Users/cuiqingli123/Workspace/torch_op_exp/mobile_net_v3_small"
# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) # path to the SavedModel directory
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
# Save the model.
with open('mobile_net_v3_small_dynamic_quantized.tflite', 'wb') as f:
f.write(tflite_model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment