Tf.shape
来源:互联网 发布:淘宝上买保险可靠吗 编辑:程序博客网 时间:2024/05/21 17:58
reshape即把矩阵的形状变一下,这跟matlab一样的,但如果参数是-1的话是什么意思呢?
看一下例子哈:
In [21]:
tensor = tf.constant([1, 2, 3, 4, 5, 6, 7,8])
In [22]:
sess.run(tf.initialize_all_variables())
In [23]:
print(sess.run(tensor))
[1 2 3 4 5 6 7 8]
In [24]:
tensorReshape = tf.reshape(tensor,[2,4])
In [25]:
print(sess.run(tensorReshape))
[[1 2 3 4]
[5 6 7 8]]
In [26]:
tensorReshape = tf.reshape(tensor,[1,2,4])
In [27]:
print(sess.run(tensorReshape))
[[[1 2 3 4]
[5 6 7 8]]]
In [28]:
tensorReshape = tf.reshape(tensor,[-1,2,2])
In [29]:
print(sess.run(tensorReshape))
[[[1 2]
[3 4]]
[[5 6]
[7 8]]]
所以-1,就是缺省值,就是先以你们合适,到时总数除以你们几个的乘积,剩下几就是几,剩下的那个就是我的缺省值
阅读全文
0 0
- Tf.shape
- tf.shape()与tf.get_shape()
- tf.shape和get_shape()
- tf中几个shape问题
- Tensorflow -tf.shape(a)和a.get_shape()
- tf.shape(a)和a.get_shape()
- tf中关于shape的问题
- tensorflow学习笔记(九):tf.shape()与tensor.get_shape()
- Tensorflow API 学习(2)-tf.shape(a)和a.get_shape()
- 【TensorFlow】tf中关于shape的问题汇总
- TF
- tf
- tensorflow学习之路(4):tf.shape(xxx) vs. xxx.get_shape()
- tensorflow学习之路(4):tf.shape(xxx) vs. xxx.get_shape()
- shape
- Shape
- shape
- shape
- 二分查找算法
- Linux下安装weblogic12.1.3
- 获取所选中的一个或者多个资源
- 待学习的技术内容
- Swift_Set集合(相交、集合、反相交、非包含)
- Tf.shape
- GitHub 优秀的 Android 开源项目-参考自网络
- php一些基础语法
- Android 上传资源文件中的图片
- codeforce#420 E. Okabe and El Psy Kongroo(图论+矩阵快速幂)
- Linux Audio Stack & ALSA
- linux系统编程之管道(一):匿名管道(pipe)
- Unhandled exception in ***.exe(OLE32.DLL):0xC0000005:Access Violation
- Git教程5——远程仓库