2.3 tensorflow学习与应用——基础概念之fetch和feed

import tensorflow as tf
#Fetch
# input1 = tf.constant(3.0)
# input2 = tf.constant(2.0)
# input3 = tf.constant(5.0)
#
# add = tf.add(input2, input3)
# mul = tf.multiply(input1, add)
#
# with tf.Session() as sess:
#     result = sess.run([mul, add])
#     print(result)
#Feed
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.multiply(input1, input2)

with tf.Session()  as sess:
    result = sess.run(output, feed_dict={input1:[7], input2:[3]})
    print(result)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容