Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created September 7, 2018 11:31
Show Gist options
  • Select an option

  • Save miquelbeltran/801b3173b14a4d60fcf9dcce91e2089f to your computer and use it in GitHub Desktop.

Select an option

Save miquelbeltran/801b3173b14a4d60fcf9dcce91e2089f to your computer and use it in GitHub Desktop.
from keras import backend as K
custom_input_tensor = tf.placeholder(tf.float32, shape=(1, 784))
output_tensor = model(custom_input_tensor)
frozen_graph = freeze_session(K.get_session(), output_names[output_tensor.op.name])
tflite_model = tf.contrib.lite.toco_convert(frozen_graph,[custom_input_tensor], [output_tensor])
open("app/src/main/assets/nmist_mlp.tflite", "wb").write(tflite_model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment