stack and unstack
来源:互联网 发布:javascript获取class 编辑:程序博客网 时间:2024/05/17 07:13
tf.unstack
作用:
简单来说就是进行降维,再链接为一个可迭代的对象
Unpacks the given dimension of a rank-R
tensor into rank-(R-1)
tensors.
将R
维的tensor转换为R-1
维的tensor序列
其参数形式化的表示如下:
value : 进行操作的tensor
num : 在指定的维度上对指定数目的tensor进行操作,如不提供需要能够从value的第axis维度的shape推断出
文档中的说法是:The length of the dimension axis
.
axis : 指定进行操作的维度
以维度为(A,B,C,D)的tensor为例,axis = 2。得到的结果为长度为C的序列,output[i] = input[:, :, i, :], 每一个元素的shape为(A,B,D)
对应的np.stack
作用:将一个n
维向量序列转换成n+1
维度的单独向量
输出:在输出的第axis维上的值指示的是原序列中的index
import numpy as npa = np.array(np.reshape(range(200)), (10,4,5))
得到一个长度为10,每个元素维度(4, 5)的序列
a = np.stack(a, axis = 2)print(a.shape) // (4, 5, 10)
在第2个axis上对元素进行堆叠(stack)
注意体会堆叠的含义
阅读全文
0 0
- stack and unstack
- tf.stack和tf.unstack
- pandas学习笔记3—数据重塑图解Pivot, Pivot-Table, Stack and Unstack
- pandas 中 stack 和 unstack的用法
- tensorflow tf.stack tf.unstack 实例
- tf.stack()和tf.unstack()的用法
- 【pandas】[5] 数据行列转置,数据透视(stack,unstack,pviot,pviot_table)
- 【pandas】[5] 数据行列转置,数据透视(stack,unstack,pviot,pviot_table)
- 矩阵拼接的函数tf.stack()与矩阵分解的函数tf.unstack()示例
- Call stack and stack frame
- Stack and Heap
- Stack and Heap
- SIP and RTP Stack
- Heap and Stack
- SIP and RTP Stack
- String stack and heap
- heap and stack 精华贴
- Heap and Stack
- vj水题
- static修饰符
- 语义网基础知识
- Oracle数据库事务隔离级别
- CSocket封装类
- stack and unstack
- eclipse和Myeclipse的编码格式设置
- 理解Docker容器网络之Linux Network Namespace
- midtorder/preorder/postorder
- ubuntu搭建shadowsocks服务,并且win7电脑访问
- leetcode-100. Same Tree
- 171127 #codeforces# check_for_three
- java不支持多继承支持多接口的原因
- [Python模块学习]使用hmac模块生成加入了密钥的消息摘要