Adding source code for the tutorial tracked under BAEL-2759 (#6533)

This commit is contained in:
Kumar Chandrakant
2019-03-15 11:22:27 +05:30
committed by Grzegorz Piwowarek
parent b3fc27088b
commit dc72b8b397
8 changed files with 158 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import tensorflow as tf
graph = tf.Graph()
builder = tf.saved_model.builder.SavedModelBuilder('./model')
writer = tf.summary.FileWriter('.')
with graph.as_default():
a = tf.constant(2, name='a')
b = tf.constant(3, name='b')
x = tf.placeholder(tf.int32, name='x')
y = tf.placeholder(tf.int32, name='y')
z = tf.math.add(a*x, b*y, name='z')
writer.add_graph(tf.get_default_graph())
writer.flush()
sess = tf.Session()
sess.run(z, feed_dict = {x: 2, y: 3})
builder.add_meta_graph_and_variables(sess, [tf.saved_model.tag_constants.SERVING])
builder.save()