[英]Numpy argmax. How to compute both max and argmax?
Is there a way to get max and argmax by one stroke ?有没有办法通过一次获得 max 和 argmax ?
import numpy as np
a=[0,0,1,0]
maximum=max(a)
index=np.argmax(a)
Is there a fastest way to do it, with something like:有没有最快的方法来做到这一点,例如:
[maximum,index]=function(a)
Maybe something like this is faster...也许这样的事情会更快......
index = np.argmax(a)
max = a[index]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.