tensorflow学习笔记(2)-feed_dict
来源:互联网 发布:比价软件哪个好 编辑:程序博客网 时间:2024/05/23 00:10
x = tf.placeholder(tf.float32, shape=(1024, 1024)) y = tf.matmul(x, x) with tf.Session() as sess: print(sess.run(y)) # ERROR: 此处x还没有赋值. rand_array = np.random.rand(1024, 1024) print(sess.run(y, feed_dict={x: rand_array})) # Will succeed.
import tensorflow as tfw1=tf.Variable(tf.random_normal([1,2],stddev=1,seed=1)) #因为需要重复输入x,而每建一个x就会生成一个结点,计算图的效率会低。所以使用占位符 x=tf.placeholder(tf.float32,shape=(2,2)) x1=tf.constant([[0.7,0.9]]) a=x+w1 b=x1+w1 sess=tf.Session() sess.run(tf.global_variables_initializer()) #运行y时将占位符填上,feed_dict为字典,变量名不可变 y_1=sess.run(a,feed_dict={x:[[0.7,0.9],[1,1]]}) y_2=sess.run(b) print(y_1) print(y_2) sess.close
阅读全文
0 0
- tensorflow学习笔记(2)-feed_dict
- Tensorflow学习笔记——占位符和feed_dict(二)
- TensorFlow学习之路(0):tf.placeholder() & feed_dict={}
- [tensorflow] feed_dict 传入序列
- tensorflow48 《面向机器智能的TensorFlow实战》笔记-03-03 tensorflow基本矢量图、summary、feed_dict
- Tensorflow学习笔记(2)
- Tensorflow学习笔记(2)
- Tensorflow学习笔记2
- TensorFlow学习笔记2
- tensorflow 学习笔记 2
- TensorFlow学习笔记(一):TensorFlow安装
- TensorFlow学习笔记(二):TensorFlow入门
- tensorflow学习笔记(一):tensorflow安装
- tensorflow学习笔记(三):tensorflow 基础知识
- TensorFlow实战学习笔记2
- tensorflow 学习笔记(2)-basic_example
- Tensorflow学习笔记(3)
- TensorFlow学习笔记(一)
- C语言数组知识
- Ubuntu16.04 xampp php5.6编译mongodb
- commons-lang3工具类学习(一)
- Recycleview 在头布局里嵌套Listview
- C语言中mktime函数功能及用法
- tensorflow学习笔记(2)-feed_dict
- commons-lang3工具类学习(二)
- Redis_基础
- 【约瑟夫环】Java实现:指定人数开始从1开始报数,每当报数到m,报数m的人离开,求最后留下来人的位置
- CSS清除浮动
- leetcode 329. Longest Increasing Path in a Matrix
- 小程序在数据绑定中取整
- elasticsearch6.x.x logstash6.x.x kibana6.x.x Filebeat6.x 配置及安装 CentOS7.3或更高
- css常用效果总结