http://blog.csdn.net/jningwei/article/details/78156011
区别
NHWC
[batch, in_height, in_width, in_channels]
NCHW
[batch, in_channels, in_height, in_width]
转换
NHWC –> NCHW:
复制代码
1
2
3
4
5
6
7
8
9
import tensorflow as tf
x = tf.reshape(tf.range(24), [1, 3, 4, 2])
out = tf.transpose(x, [0, 3, 1, 2])
print x.shape
print out.shape
- 1
- 2
- 3
- 4
- 5
- 6
- 7
复制代码
1
2
3
4
(1, 3, 4, 2)
(1, 2, 3, 4)
- 1
- 2
NCHW –> NHWC:
复制代码
1
2
3
4
5
6
7
8
9
import tensorflow as tf
x = tf.reshape(tf.range(24), [1, 2, 3, 4])
out = tf.transpose(x, [0, 2, 3, 1])
print x.shape
print out.shape
- 1
- 2
- 3
- 4
- 5
- 6
- 7
复制代码
1
2
(1, 2, 3, 4)
(1, 3, 4, 2)
最后
以上就是喜悦苗条最近收集整理的关于NHWC与NCHW的全部内容,更多相关NHWC与NCHW内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复