日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】)

發布時間:2025/3/19 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
def argmax(a, axis=None, out=None):"""Returns the indices of the maximum values along an axis.返回沿軸的最大值的索引。Parameters----------a : array_likeInput array.輸入數組。axis : int, optionalBy default, the index is into the flattened array, otherwisealong the specified axis.默認情況下,索引位于平面數組中(就是直接把數組攤開,沒有軸的概念),否則沿指定的軸。out : array, optionalIf provided, the result will be inserted into this array. It shouldbe of the appropriate shape and dtype.如果提供,結果將被插入此數組。 它應該具有適當的形狀和dtype。Returns-------index_array : ndarray of ints 整數數組Array of indices into the array. It has the same shape as `a.shape`with the dimension along `axis` removed.索引數組到數組中。 它的形狀與“ a.shape”相同,但沿“軸”的尺寸已刪除。See Also--------ndarray.argmax, argminamax : The maximum value along a given axis.unravel_index : Convert a flat index into an index tuple.Notes-----In case of multiple occurrences of the maximum values, the indicescorresponding to the first occurrence are returned.在多次出現最大值的情況下,返回對應于第一次出現的索引。Examples-------->>> a = np.arange(6).reshape(2,3)>>> aarray([[0, 1, 2],[3, 4, 5]])>>> np.argmax(a)5>>> np.argmax(a, axis=0)array([1, 1, 1])>>> np.argmax(a, axis=1)array([2, 2])Indexes of the maximal elements of a N-dimensional array:N維數組的最大元素的索引:>>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape)>>> ind(1, 2)>>> a[ind]5>>> b = np.arange(6)>>> b[1] = 5>>> barray([0, 5, 2, 3, 4, 5])>>> np.argmax(b) # Only the first occurrence is returned. 僅返回第一個匹配項。1"""return _wrapfunc(a, 'argmax', axis=axis, out=out)

總結

以上是生活随笔為你收集整理的python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。