tensorflow: (data_format) NHWC、NCHW 区别与转换
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow
免费下载资源
·
区别
NHWC
[batch, in_height, in_width, in_channels]
NCHW
[batch, in_channels, in_height, in_width]
转换
NHWC –> NCHW:
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, 3, 4, 2)
(1, 2, 3, 4)
NCHW –> NHWC:
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)
(1, 3, 4, 2)
GitHub 加速计划 / te / tensorflow
184.55 K
74.12 K
下载
一个面向所有人的开源机器学习框架
最近提交(Master分支:2 个月前 )
a49e66f2
PiperOrigin-RevId: 663726708
2 个月前
91dac11a
This test overrides disabled_backends, dropping the default
value in the process.
PiperOrigin-RevId: 663711155
2 个月前
更多推荐
已为社区贡献24条内容
所有评论(0)