如何获取 3d np 数组的 np.amin 的索引?

How to get indices of np.amin of 3d np array?

给定以下代码:

import numpy as np

x = np.array([[[1, 2],
               [3, 4]],
              
              [[5, 6],
               [7, 8]], 
              
              [[3, 1],
               [1, 5]]])

x_min = np.amin(x, axis=0)
print(x_min)

输出(x_min)是

[[1 1]
 [1 4]]

现在我想得到数组x的第0维索引作为x_min数组的结果,应该是:

[[0 2]
 [2 0]]

我可以使用哪个函数来获取这些索引?

尝试 np.argminnp.argmin(x, axis=0)