Python Numpy和keras张量大小混淆

Python Numpy和keras张量大小混淆,python,numpy,keras,Python,Numpy,Keras,无论我做什么改变,densite\u输入总是想要“(无,296)”。错误是: ValueError: Error when checking model input: expected dense_1_input to have shape (None, 296) but got array with shape (296, 1) ` 代码: 通过以下方式更改myGenerator()函数: result = result.reshape(1, 296) 因此,整形操作符的结果将被保存

无论我做什么改变,
densite\u输入总是想要“(无,296)”。错误是:

ValueError: Error when checking model input: expected dense_1_input to have shape (None, 296) but got array with shape (296, 1)    `
代码:


通过以下方式更改
myGenerator()
函数:

result = result.reshape(1, 296)

因此,整形操作符的结果将被保存。

整形
不起作用,因此当您执行
结果时。整形(1296)
您实际上并没有修改
结果
。试试
result=result。重塑(1296)
,它会解决你的问题
result = result.reshape(1, 296)