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

来源:互联网 发布:阿里云盘怎么用 编辑:程序博客网 时间:2024/06/03 23:43

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

原创粉丝点击