问题描述
我正在尝试在 (0,1) 轴上找到 3d 数组的最大索引。
我尝试将 argwhere 与 amax 一起使用,但如果它有多个最大值,它会在轴上返回多个索引
x = [[[ 4 5 9]
[ 0 13 6]]
[[12 11 13]
[ 5 13 8]]]
np.amax(x,axis=(0,1))
>> [12 13 13] #I just want the indices of the following max values
x==np.amax(x,1))
#this seems to be the problem,multiple True in the second column
v
>>[[[False False False]
[False True False]]
[[True False True]
[False True False]]]
np.argwhere(x==np.amax(x,1))) #this should return 3 indices instead of 4
>>[[0 1 1]
[1 0 0]
[1 0 2]
[1 1 1]]
那么是否有任何“numpy 方法”可以在 (0,1) 轴上获得 3d 数组的唯一最大索引。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)