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

爱⌒轻易说出口 提交于 2020-01-07 02:03:38

问题


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)

回答1:


Ignoring the fact that (np.array(z.shape) > np.array(qcloud.shape)).any(), you want argmax:

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


来源:https://stackoverflow.com/questions/37446740/finding-the-element-in-one-array-corresponding-to-the-maximum-value-in-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!