感谢乌恩大侠的BLOG
- feed_dict:是sess.run()中的一个参数
作用:替换图中某个tensor的值
a = tf.add(2 , 5)
b = tf.multiply(a , 3)
with tf.Session() as sess:
sess.run(b)
#ans = 21
- 好象这样写会报错,待我明白了再来改:
replace_dict = {a:8}
sess.run(b , feed_dict = replace_dict)
#当次计算有效
a = tf.add(2 , 5)
b = tf.multiply(a , 3)
with tf.Session() as sess:
sess.run(b)
#ans = 21
replace_dict = {a:8}
sess.run(b , feed_dict = replace_dict)
#当次计算有效