tf4. Placeholder

来源:互联网 发布:办公平台软件免费 编辑:程序博客网 时间:2024/06/18 09:59
import sysprint(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 做乘法运算,并输出为 outputouput = tf.multiply(input1, input2)with tf.Session() as sess:    print(sess.run(ouput, feed_dict={input1: [7.], input2: [2.]}))# [ 14.]
原创粉丝点击