fujiyuu75
4/24/2017 - 6:28 AM

tensorflow_placeholder.py

import tensorflow as tf

x = tf.constant(1, name="x")
y = tf.placeholder(tf.int32, name="y")

sum = tf.add(x, y)

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    print(sess.run(sum, feed_dict={y:2}))
    print(sess.run(sum, feed_dict={y:4}))