美文网首页
tf4. Placeholder

tf4. Placeholder

作者: 球球之家 | 来源:发表于2017-07-16 18:53 被阅读0次
import sys
print(sys.version)
'''
3.5.3 |Continuum Analytics, Inc.| (default, May 15 2017, 10:43:23) [MSC v.1900 64 bit (AMD64)]
'''
import tensorflow as tf

#在 Tensorflow 中需要定义 placeholder 的 type ,一般为 float32 形式
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)

# mul = multiply 是将input1和input2 做乘法运算,并输出为 output
ouput = tf.multiply(input1, input2)
with tf.Session() as sess:
    print(sess.run(ouput, feed_dict={input1: [7.], input2: [2.]}))
# [ 14.]

相关文章

网友评论

      本文标题:tf4. Placeholder

      本文链接:https://www.haomeiwen.com/subject/zjrohxtx.html