NCHW与NHWC 2020-02-11 AI 次阅读 文章目录 转换 NHWC –> NCHW: NCHW –> NHWC: 转换 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, 3, 4, 2) (1, 2, 3, 4) 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) (1, 3, 4, 2) NC4HW4 看起来像是大图像被拆分成4X4的小块,block内部按照nhwc保存,可以优化cache性能。 文章作者 carter2005 上次更新 2020-02-11