TypeError: data type not understood in numpy

TypeError: data type not understood in numpy

我正在为神经网络使用 numpy,但我遇到了这个错误

TypeError: data type not understood

我的代码是

a = np.array([7, 7, 7], [7, 7, 7])
print(np.argmax(np.array([[5, 6, 7], [1, 2, 3]]), axis = 0, a))

只是为了澄清@dimay 的评论: np.array 接收两个输入,第一个是数据本身,第二个是数据类型。当你想要两行时,你应该给 np.array 一个列表列表。 np.array 试图创建一个包含元素 [7, 7, 7] 的一维数组,而另一个 [7, 7, 7] 被认为是 dtype,这导致了错误。