tensorflow代码实战4_placeholder传入值_简单例子

说明:资料来源于莫烦老师教程:

https://www.youtube.com/watch?v=fCWbRboJ4Rs&list=PLXO45tsB95cKI5AIlf5TxxFPzb-0zeVZ8&index=12

一、代码

import tensorflow as tf

input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)

output = tf.multiply(input1,input2)#原来的写法是tf.mul()
with tf.Session() as sess:
	print(sess.run(output,feed_dict={input1:[7.],input2:[2.]}))#用feed_dict字典传入数据

二、运行结果

 

你可能感兴趣的:(随笔,Tensorflow,python)