Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'int' object has no attribute 'ndim' #23

Open
zyayoung opened this issue Jan 24, 2018 · 4 comments
Open

AttributeError: 'int' object has no attribute 'ndim' #23

zyayoung opened this issue Jan 24, 2018 · 4 comments

Comments

@zyayoung
Copy link

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'
@qq191513
Copy link

me too!!!!!

@aaronopp
Copy link

aaronopp commented Feb 7, 2018

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!

@kechan
Copy link

kechan commented Feb 25, 2018

@aaronopp The link you posted no longer works. So is this a Keras bug? Is there any workaround other than rolling back to 2.1.2?

@eromoe
Copy link

eromoe commented May 8, 2018

@aaronopp is right. I think keras should collect such error into version list, and give a simple advise(such as swtich to which version ) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants