TensotFlow 应用实例:04-placeholder的使用

版权声明:欢迎转载,转载请注明出处! https://blog.csdn.net/iTaacy/article/details/76405529

TensotFlow 应用实例:04-placeholder的使用

本文是我在学习TensotFlow 的时候所记录的笔记,共享出来希望能够帮助一些需要的人。

placeholder因为解释为占位符,在TensotFlow当中也就是用来占位的,代码如下:

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.]}))

本文代码GitHub地址 tensorflow_learning_notes

猜你喜欢

转载自blog.csdn.net/iTaacy/article/details/76405529
今日推荐