Skip to content

Commit 24f9626

Browse files
committed
Add additional input data validation check
1 parent 0e6e7a4 commit 24f9626

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

keras/engine/training.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def standardize_input_data(data, names, shapes=None, check_batch_dim=True,
6666
': data should be a Numpy array, '
6767
'or list/dict of Numpy arrays. '
6868
'Found: ' + str(data)[:200] + '...')
69+
if len(names) != 1:
70+
# case: model expects multiple inputs but only received
71+
# a single Numpy array
72+
raise Exception('The model expects ' + str(len(names)) +
73+
' input arrays, but only received one array. '
74+
'Found: array with shape ' + str(data.shape))
6975
arrays = [data]
7076

7177
# make arrays at least 2D

0 commit comments

Comments
 (0)