Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras : AttributeError: 'int' object has no attribute 'ndim' when using model.fit

when triying to fit the model i get this error

i'm using Keras and every time i try to fit my model

padded_model.fit(train_X, train_y, epochs=50, verbose=1)

i get this error :

'int' object has no attribute 'ndim'

like image 878
collin Avatar asked Feb 09 '18 06:02

collin


1 Answers

If train_x and train_y are normal Python lists, they don't have the attribute .ndim. Only Numpy arrays have this attribute representing the number of dimensions.

(https://docs.scipy.org/doc/numpy-1.12.0/reference/generated/numpy.ndarray.ndim.html)

like image 198
Joe Avatar answered Nov 15 '22 00:11

Joe