-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Closed
Closed
Copy link
Description
I've got code that works in the keras-1 compatibility layer of keras-2, but fails when I use the new concatenate()
API.
Key lines:
concat_axis = 1 if K.image_data_format() == 'channels_first' else -1
x_list = [x]
for i in range(nb_layers):
x = __conv_block(x, growth_rate, bottleneck,
dropout_rate, weight_decay)
x_list.append(x)
# commenting merge() and uncommenting concatenate() fails
x = merge(x_list, mode='concat', concat_axis=concat_axis)
# x = concatenate(x_list, concat_axis)
if grow_nb_filters:
nb_filter += growth_rate
if return_concat_list:
return x, nb_filter, x_list
else:
return x, nb_filter
Error:
Traceback (most recent call last):
File "/Users/athundt/source/keras-contrib/keras_contrib/applications/densenet.py", line 712, in <module>
dn = DenseNet()
File "/Users/athundt/source/keras-contrib/keras_contrib/applications/densenet.py", line 136, in DenseNet
model = Model(inputs, x, name='densenet')
File "/usr/local/lib/python2.7/site-packages/Keras-2.0.1-py2.7.egg/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/Keras-2.0.1-py2.7.egg/keras/engine/topology.py", line 1704, in __init__
str(layers_with_complete_input))
RuntimeError: Graph disconnected: cannot obtain value for tensor Tensor("conv2d_2/convolution:0", shape=(?, 32, 32, 12), dtype=float32) at layer "concatenate_1". The following previous layers were accessed without issue: ['input_1', 'initial_conv2D', 'batch_normalization_1', 'activation_1', 'conv2d_1']
The full code is in keras-team/keras-contrib@bf95474
Thank you!
-
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps -
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
-
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
Metadata
Metadata
Assignees
Labels
No labels