数组切片笔记
a = np.random.randint(1, 100, [2, 3, 4])
a
array([[[90, 71, 53, 24],
[ 6, 74, 99, 21],
[39, 30, 94, 32]],
[[83, 5, 24, 96],
[48, 47, 91, 24],
[40, 40, 58, 89]]])
a.max(0)
array([[90, 71, 53, 96],
[48, 74, 99, 24],
[40, 40, 94, 89]])
print(a.max(0).shape)
(3, 4)
'''
把(2,3,4) 看成是(c,w,h) max(c) 就是球通道上的最大值 就是 2个(1,3,4)中 每个元素对应的最大值。
例如max(90,83), max(71,5).......max(32, 89)
'''
a.max(1)
array([[90, 74, 99, 32],
[83, 47, 91, 96]])
print(a.max(1).shape)
(2, 4)