В 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)
(192, 1)
и пропуская 1-ой оси; то есть 192
и 1
. Если array
имеет форму (n, 192)
, это, вероятно, пройдет.
В основном, что-то генерирует форму (192,1)
, в противоположность (1,192)
или вещанию (192,)
вызывает ошибку.
Я добавляю keras
к тегам, которые предполагают, что это проблемный модуль.
Searching другие keras
помечено SO вопросы:
Exception: Error when checking model target: expected dense_3 to have shape (None, 1000) but got array with shape (32, 2)
Error: Error when checking model input: expected dense_input_6 to have shape (None, 784) but got array with shape (784L, 1L)
Dimensions not matching in keras LSTM model
Getting shape dimension errors with a simple regression using Keras
Deep autoencoder in Keras converting one dimension to another i
Я не знаю достаточно о keras
, чтобы понять ответы, но есть нечто большее, чем просто переформатировать ваш входной массив.
'arr.ravel() [None]' или 'arr.reshape (1, -1)'? – Divakar
[Подозрительно подобный] (https://github.com/fchollet/keras/issues/3109) –
@AndrasDeak Спасибо за ссылку! – Ritchie