简体   繁体   中英

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'

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM