在一个数组中查找对应于另一个数组中最大值的元素

Finding the element in one array corresponding to the maximum value in another

如何对齐4d z数组和4d QCLOUD数组,然后找出QCLOUD max出现时的z值?

print(z.shape)
print(qcloud.shape)
out: (6, 100, 128, 128)
(6, 99, 128, 128)

忽略 (np.array(z.shape) > np.array(qcloud.shape)).any() 这个事实,你想要 argmax:

idx = np.argmax(qcloud)
result = z[tuple(idx)]