Tensorflow之改变tensor形状
2017-03-11 10:29
183 查看
https://www.tensorflow.org/versions/r0.12/api_docs/python/array_ops.html#reshape
例子:
例子:
# tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9] # tensor 't' has shape [9] reshape(t, [3, 3]) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9]] # tensor 't' is [[[1, 1], [2, 2]], # [[3, 3], [4, 4]]] # tensor 't' has shape [2, 2, 2] reshape(t, [2, 4]) ==> [[1, 1, 2, 2], [3, 3, 4, 4]] # tensor 't' is [[[1, 1, 1], # [2, 2, 2]], # [[3, 3, 3], # [4, 4, 4]], # [[5, 5, 5], # [6, 6, 6]]] # tensor 't' has shape [3, 2, 3] # pass '[-1]' to flatten 't' reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6] # -1 can also be used to infer the shape # -1 is inferred to be 9: reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]] # -1 is inferred to be 2: reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]] # -1 is inferred to be 3: reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], [2, 2, 2], [3, 3, 3]], [[4, 4, 4], [5, 5, 5], [6, 6, 6]]] # tensor 't' is [7] # shape `[]` reshapes to a scalar reshape(t, []) ==> 7
相关文章推荐
- Tensorflow之Tensor形状变换和剪切组合
- tensorflow 张量的阶、形状、数据类型及None在tensor中表示的意思
- tensorflow 张量的阶、形状、数据类型及None在tensor中表示的意思。
- tensorflow:如何将tensor A 的形状reshape为tensor b 的形状
- tensorflow中张量(tensor)的属性——维数(阶)、形状和数据类型
- TensorFlow实战15:TensorBoard的使用(tensorflow的可视化工具)
- tensorflow (1,n)的tensor 和 (n,1)的tensor 的add
- 对Tensorflow中tensor的理解
- TensorFlow笔记:Session.run()与Tensor.eval()
- 改变窗体形状
- Qt--改变鼠标形状
- 使用Spread.Net如何改变形状外观
- tensorflow入门(三)---tensorflow的计算图和tensor
- tensorflow 学习专栏(一):输出Hello tensorflow!
- 【TensorLayer】建立在TensorFlow上的深度学习(Deep Learning)与增强学习(Reinforcement Learning) 软件库
- 深度学习框架TensorFlow学习与应用(五)——TensorBoard结构与可视化
- Tensorflow之class Tensor
- tensorflow windows安装 Error import tensorflow错误解决方法
- tensorflow+入门笔记︱基本张量tensor理解与tensorflow运行结构
- Tensorflow实战学习(四十七)【PlayGround,TensorBoard】