深度学习——索引操作的学习笔记

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)

猜你喜欢

转载自blog.csdn.net/songyuc/article/details/106712098