Have you tried this:
import numpy as np
x = np.random.randint(0, 10, (3, 5, 10))
print(x)
maxes = x[:,:,2].max(axis=1)
print(maxes)
[[[5 0 6 6 4 7 5 0 4 8]
[0 6 8 8 2 1 7 5 4 3]
[2 7 5 5 0 2 6 8 6 3]
[5 9 7 5 1 1 5 4 8 7]
[0 2 3 7 8 1 9 1 2 6]]
[[8 9 4 3 3 6 0 4 9 1]
[1 5 6 4 3 2 7 7 0 2]
[3 2 0 1 9 6 5 8 0 5]
[6 1 5 9 1 6 4 7 4 5]
[7 2 5 8 6 8 5 1 9 5]]
[[9 4 0 9 0 6 3 7 4 1]
[4 1 4 9 1 1 1 2 0 6]
[7 3 3 2 5 2 0 6 9 1]
[1 7 0 1 8 1 3 8 6 4]
[6 9 0 2 6 0 2 1 7 7]]]
[8 6 4]
To understand how this works checkout:
And, to get the maximum of all the columns:
col_maximums = x.max(axis=1)
print(col_maximums)
[[5 9 8 8 8 7 9 8 8 8]
[8 9 6 9 9 8 7 8 9 5]
[9 9 4 9 8 6 3 8 9 7]]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…