tensorflow cifar10的cifar10_input.py中read_cifar10()最后有一个转置语句
result.uint8image = tf.transpose(depth_major, [1, 2, 0])
用以下语句直观感受一下
import as
import numpy as np
1231231231231231231231231231'depth'2'height'3'width'dtypeshape333perm120with as feed_dictprintprintfor in rangelen0for in rangelen1for in rangelen2for in rangelen0for in rangelen1for in rangelen2printprint'before_trans:\n'print
print('after_trans:\n',np.array(after_trans))
# 结果
before_trans:
[[['depth' 'height' 'width']
['depth' 'height' 'width']
['depth' 'height' 'width']]
[['depth' 'height' 'width']
['depth' 'height' 'width']]]
after_trans:
[[['depth' 'depth' 'depth']
['height' 'height' 'height']
['width' 'width' 'width']]
[['depth' 'depth' 'depth']
['width' 'width' 'width']]]