深度學習——索引操作的學習筆記

1 致謝

感謝網友粗麪魚丸提供的資料,

原文鏈接:https://www.cnblogs.com/subic/p/8710946.html

2 numpy中索引的學習筆記

1.1 如果獲得np矩陣的最大值的索引

可以參考下面的示例代碼:

import numpy as np
matrix = np.array([[1, 2, 3],
              [4, 5, 6]])
index = np.unravel_index(matrix.argmax(), matrix.shape)
print(index)
>>>(1, 2)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章