tensorflow基本语法理解
来源:互联网 发布:韩火火淘宝店 编辑:程序博客网 时间:2024/05/22 00:10
最近在看RNN时,对tf.unpack()维度变化不了解,经过试验大致了解了维度的变化
构造三维数据分布如下图所示:
情况一:
import tensorflow as tfa = tf.constant([[[1,1,1],[1,1,1]], [[2,2,2],[2,2,2]], [[3,3,3],[3,3,3]], [[4,4,4],[4,4,4]], [[5,5,5],[5,5,5]]])d = tf.unstack(a,5,axis=0)with tf.Session() as sess: #print(sess.run(c)) print(sess.run(d)) #print(sess.run(e))
结果
相当于用五个平面切割z轴,会得到5个平面
[array([[1, 1, 1],
[1, 1, 1]], dtype=int32), array([[2, 2, 2],
[2, 2, 2]], dtype=int32), array([[3, 3, 3],
[3, 3, 3]], dtype=int32), array([[4, 4, 4],
[4, 4, 4]], dtype=int32), array([[5, 5, 5],
[5, 5, 5]], dtype=int32)]
情况二:
import tensorflow as tfa = tf.constant([[[1,1,1],[1,1,1]], [[2,2,2],[2,2,2]], [[3,3,3],[3,3,3]], [[4,4,4],[4,4,4]], [[5,5,5],[5,5,5]]])d = tf.unstack(a,2,axis=1)with tf.Session() as sess: #print(sess.run(c)) print(sess.run(d)) #print(sess.run(e))
结果:
相当于用两个平面切割x轴,会得到2个平面
[array([[1, 1, 1],
[2, 2, 2],
[3, 3, 3],
[4, 4, 4],
[5, 5, 5]], dtype=int32), array([[1, 1, 1],
[2, 2, 2],
[3, 3, 3],
[4, 4, 4],
[5, 5, 5]], dtype=int32)]
情况三:
import tensorflow as tfa = tf.constant([[[1,1,1],[1,1,1]], [[2,2,2],[2,2,2]], [[3,3,3],[3,3,3]], [[4,4,4],[4,4,4]], [[5,5,5],[5,5,5]]])d = tf.unstack(a,3,axis=2)with tf.Session() as sess: #print(sess.run(c)) print(sess.run(d)) #print(sess.run(e))
结果:
相当于用三个平面切割x轴,会得到3个平面
[array([[1, 1],
[2, 2],
[3, 3],
[4, 4],
[5, 5]], dtype=int32), array([[1, 1],
[2, 2],
[3, 3],
[4, 4],
[5, 5]], dtype=int32), array([[1, 1],
[2, 2],
[3, 3],
[4, 4],
[5, 5]], dtype=int32)]
- tensorflow基本语法理解
- tensorflow基本语法
- tensorflow基本语法
- 关于tensorflow的基本语法知识
- TensorFlow入门(3):基本语法
- Tensorflow基本语法和实现神经网络
- tensorflow 语法
- LLDB之理解LLDB基本命令语法
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- #####tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构 ***********######
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- tensorflow语法学习
- tensorflow 语法小结
- tensorflow基础语法
- 基本语法
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- Java数据类型分类
- MFC计算器项目——进制转换模块
- 在MacOS下,设置环境变量
- 自定义fragment抽象父类
- tensorflow基本语法理解
- poj2243--骑士骑马--bfs算法
- 最近两年跟踪算法归纳
- maven常用镜像仓库
- Nodejs创建HTTPS服务器
- python求一个时间点的前一个月和后一个月
- php中GET方法加号变成空格
- 去除list集合中重复项的几种方法
- POJ 3233 Matrix Power Series