AttributeError: 'int' object has no attribute 'ndim'
zyayoung opened this issue · comments
zyayoung commented
Keras2.1.3
Python 2.7
Thenao 1.0.1
root@localhost:~/zya/keras-dcgan# python dcgan.py --mode train
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using Theano backend.
dcgan.py:19: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(units=1024, input_dim=100)`
model.add(Dense(input_dim=100, output_dim=1024))
('Epoch is', 0)
('Number of batches', 468)
Traceback (most recent call last):
File "dcgan.py", line 160, in <module>
train(BATCH_SIZE=args.batch_size)
File "dcgan.py", line 106, in train
d_loss = d.train_on_batch(X, y)
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 1069, in train_on_batch
class_weight=class_weight)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1843, in train_on_batch
check_batch_axis=True)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1430, in _standardize_user_data
exception_prefix='target')
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 70, in _standardize_input_data
data = [np.expand_dims(x, 1) if x is not None and x.ndim == 1 else x for x in data]
AttributeError: 'int' object has no attribute 'ndim'
c commented
me too!!!!!
aaronopp commented
It's a bug with Keras 2.1.3 specifically. Check this out: https://github.com/rstudio/keras/issues/262
I rolled back to version 2.1.2 and everything worked fine!