tensorflow中的placeholder的机制

import tensorflow as tf

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:[7.],input2:[2.]}))

在tensorflow中,有一个机制叫做placeholder,首先创建变量但是不进行赋值,在最后sess.run(op,feed_dict={  }  )用feed_dict进行赋值操作,

猜你喜欢

转载自blog.csdn.net/weixin_41950276/article/details/83683954