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

problem with multiple inputs model in Keras #4823

Closed
ghost opened this issue Dec 24, 2016 · 1 comment
Closed

problem with multiple inputs model in Keras #4823

ghost opened this issue Dec 24, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 24, 2016

Hi all, I have an exception rising when using multiple inputs model in Keras, here is my model:
....
....
model_conv.add(MaxPooling2D(pool_size=pool_size))
model_conv.add(Dropout(0.5))
model_conv.add(Flatten())
model_seq = Sequential()
model_seq.add(Dense(1024, input_dim=k, activation='relu'))
merged_model = Sequential()
merged_model.add(Merge([model_conv, model_seq], mode='concat', concat_axis=1))
merged_model.add(Dense(2048, init='he_normal',activation='relu'))
.....
......
merged_model.fit([X_train, H_train], Y_train, batch_size=batch_size, nb_epoch=nb_epoch, callbacks=[checkpoint, board], verbose=1,
validation_data=([X_test, H_test], Y_test))

I tensorflow/core/common_runtime/gpu/gpu_device.cc:855] cannot enable peer access from device ordinal 0 to device ordinal 1
I tensorflow/core/common_runtime/gpu/gpu_device.cc:855] cannot enable peer access from device ordinal 1 to device ordinal 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 1
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y N
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 1: N Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K20Xm, pci bus id: 0000:03:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tesla K20Xm, pci bus id: 0000:83:00.0)
Traceback (most recent call last):
File "program_merge.py", line 136, in
validation_data=([X_test, H_test], Y_test))
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 627, in fit
sample_weight=sample_weight)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1052, in fit
batch_size=batch_size)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 979, in _standardize_user_data
exception_prefix='model input')
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 85, in standardize_input_data
if len(array.shape) == 1:
AttributeError: 'list' object has no attribute 'shape'

I'm sure my training and validation data are good.
Thanks.

@ghost
Copy link
Author

ghost commented Dec 24, 2016

I think it worked for me, I just changed: X_test to np.array(X_test) and H_test to np.array(H_test) and the same think for the training data. Sorry for this.

@stale stale bot added the stale label May 23, 2017
@stale stale bot closed this as completed Jun 22, 2017
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

0 participants