Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created August 31, 2018 06:54
Show Gist options
  • Select an option

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

Select an option

Save miquelbeltran/efd06894772cf65d4ef7d57fce94a4ab to your computer and use it in GitHub Desktop.
import tensorflow as tf
img = tf.placeholder(name="img", dtype=tf.float32, shape=(1))
val = img + tf.constant([1.])
out = tf.identity(val, name="out")
with tf.Session() as sess:
output = sess.run(out, feed_dict={img: [1]})
print(output)
tflite_model = tf.contrib.lite.toco_convert(sess.graph_def, [img], [out])
open("plus_one.tflite", "wb").write(tflite_model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment