""" Example to demonstrate the use of feed_dict
Author: Chip Huyen
Prepared for the class CS 20SI: "TensorFlow for Deep Learning Research"
cs20si.stanford.edu
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
a = tf.placeholder(tf.float32, shape=[3])
b = tf.constant([5, 5, 5], tf.float32)
c = a + b
with tf.Session() as sess:
print(sess.run(c, {a: [1, 2, 3]}))
a = tf.add(2, 5)
b = tf.multiply(a, 3)
with tf.Session() as sess:
replace_dict = {a: 15}
print(sess.run(b, feed_dict=replace_dict))