In keras/keras/engine/training.py
def standardize_input_data(data, names, shapes=None,
check_batch_dim=True,
exception_prefix=''):
...
# check shapes compatibility
if shapes:
for i in range(len(names)):
...
for j, (dim, ref_dim) in enumerate(zip(array.shape, shapes[i])):
if not j and not check_batch_dim:
# skip the first axis
continue
if ref_dim:
if ref_dim != dim:
raise Exception('Error when checking ' + exception_prefix +
': expected ' + names[i] +
' to have shape ' + str(shapes[i]) +
' but got array with shape ' +
str(array.shape))
将其与错误进行比较
Error when checking : expected input_1 to have shape (None, 192) but got array with shape (192, 1)
所以这是比较(None, 192)
with (192, 1)
,并跳过第一个轴;那就是比较192
and 1
. If array
有形状(n, 192)
它可能会过去。
所以基本上,什么产生了(192,1)
形状,而不是(1,192)
或可广播的(192,)
导致错误。
我正在添加keras
根据标签猜测这是有问题的模块。
搜索其他keras
标记的问题:
异常:检查模型目标时出错:预期 dend_3 具有形状 (None, 1000),但得到形状为 (32, 2) 的数组 https://stackoverflow.com/questions/39335434/exception-error-when-checking-model-target-expected-dense-3-to-have-shape-non
错误:检查模型输入时出错:预期dense_input_6具有形状(无,784),但得到形状为(784L,1L)的数组 https://stackoverflow.com/questions/37901698/error-error-when-checking-model-input-expected-dense-input-6-to-have-shape-no
keras LSTM 模型中的尺寸不匹配 https://stackoverflow.com/questions/40088381/dimensions-not-matching-in-keras-lstm-model
使用 Keras 通过简单回归获取形状尺寸误差 https://stackoverflow.com/questions/39308273/getting-shape-dimension-errors-with-a-simple-regression-using-keras
Keras 中的深度自动编码器将一个维度转换为另一个维度 https://stackoverflow.com/questions/39976718/deep-autoencoder-in-keras-converting-one-dimension-to-another-i
我还不够了解keras
理解答案,但它不仅仅是简单地重塑输入数组。