Keras: problem with multiple inputs model in Keras

Created on 24 Dec 2016  路  1Comment  路  Source: keras-team/keras

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.

stale

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings