Adding source code for the tutorial tracked under BAEL-2759 (#6533)
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
b3fc27088b
commit
dc72b8b397
16
tensorflow-java/src/main/python/tensorflowGraph.py
Normal file
16
tensorflow-java/src/main/python/tensorflowGraph.py
Normal 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()
|
||||
Reference in New Issue
Block a user