TensorFlow-placeholder传入值

import tensorflow._api.v2.compat.v1 as tf
tf.disable_v2_behavior()
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

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.]}))#开始运行
posted @ 2022-05-05 08:56  又一岁荣枯  阅读(26)  评论(0编辑  收藏  举报