在一个数组中查找与另一个数组中的最大值相对应的元素 [英] Finding the element in one array corresponding to the maximum value in another
本文介绍了在一个数组中查找与另一个数组中的最大值相对应的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何对齐4d z数组和4d QCLOUD数组,然后找出发生QCLOUD max的z值?
How can I align the 4d z array and the 4d QCLOUD array and to then find out the z value of when QCLOUD max occurs?
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)]
这篇关于在一个数组中查找与另一个数组中的最大值相对应的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文