#coding=utf-8
import tensorflow as tf
#申明一个placeholder,理解为占位,shape可以填充时定,也可以事先定,run的时候填充数据
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.mul(input1, input2)
with tf.Session() as sess:
print(sess.run([output], feed_dict={input1:[7.], input2:[2.]}))
# output:
# [array([ 14.], dtype=float32)]
tensorflow实战-3.placeholder
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 3.2 TensorFlow实现Softmax Regression识别手写数字 MNIST(Mixed Nati...
- 3.1 TensorFlow的编译及安装 安装有两种情况 使用CPU,安装容易 使用GPU,需要先安装CUDA和c...
- TensorFlow从0到1系列回顾 《TensorFlow从0到1》写到现在,TensorFlow的版本也从当时...