简体   繁体   English

类型错误:numpy 中无法理解数据类型

[英]TypeError: data type not understood in numpy

I was working with numpy for Neural Networks and I am facing This Error我正在为神经网络使用 numpy,我正面临这个错误

TypeError: data type not understood类型错误:无法理解数据类型

and my code was我的代码是

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

Just to clarify @dimay 's comment: np.array receives two inputs, with the first being the data itself, and the second being the datatype.只是为了澄清@dimay 的评论: np.array 接收两个输入,第一个是数据本身,第二个是数据类型。 When you want two rows, you should be giving np.array a list of lists.当你想要两行时,你应该给 np.array 一个列表列表。 np.array tried to create a 1-d array with the elements [7, 7, 7], and the other [7, 7, 7] was thought to be a dtype, which leads to the error. np.array 尝试创建一个包含元素 [7, 7, 7] 的一维数组,而另一个 [7, 7, 7] 被认为是 dtype,从而导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM