tensorflow placeholder的使用

import tensorflow as tf

input1 = tf.placeholder(tf.float32) # 设置placeholder
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.]})) # 输入字典的数据

输出

[14.]

你可能感兴趣的:(tensorflow placeholder的使用)