collin
collin

Reputation: 83

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'

Upvotes: 7

Views: 15132

Answers (1)

Joe
Joe

Reputation: 7121

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)

Upvotes: 13

Related Questions