-
首先引入Tensorflow
import tensorflow as tf -
定义运算规则和变量
#placeholder是TensorFlow的占位符节点,可以理解为一种形参,在调用run方法是传递。
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.multiply(input1, input2) -
从字典中完成取值
with tf.Session() as sess:
print(sess.run(output, feed_dict={input1:[2.5],input2:[3.0]})) -
运算结果:
Tensorflow中的Feed and Fetch
最新推荐文章于 2020-02-15 21:06:13 发布