Keras: multi_gpu_model seems not to work

Created on 15 Oct 2018  路  4Comments  路  Source: keras-team/keras

simple code :

from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential()
model.add(Dense(32, input_dim=784))
model.add(Activation('relu'))
parralelmodel =tf.keras.utils.multi_gpu_model(model, gpus=4)

gives me

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py in __init__(self, outbound_layer, inbound_layers, node_indices, tensor_indices, input_tensors, output_tensors, arguments)
1758 # For compatibility with external Keras, we use the deprecated
1759 # accessor here.
-> 1760 layer.outbound_nodes.append(self)
1761 # For compatibility with external Keras, we use the deprecated
1762 # accessor here.

AttributeError: 'InputLayer' object has no attribute 'outbound_nodes'

I use keras 2.2.4 and tensorflow 1.11.0 on cuda 9.0

To investigate tensorflow

Most helpful comment

In TF 1.13.1 same errors.

All 4 comments

I used tf.keras.utils.multi_gpu_model because it is mentioned there:
https://www.tensorflow.org/api_docs/python/tf/keras/utils/multi_gpu_model
but if I replace by keras.utils.multi_gpu_model , now it works.

so it is more a consistency problem with the tensorflow doc, and of course a consistency problem between 2 versions of the code

Is this still an issue with latest versions of TF and keras? Thanks.

Closing due to lack of recent activity. Please update the issue when new information becomes available, and we will open a new issue. Thanks!

In TF 1.13.1 same errors.

Was this page helpful?
0 / 5 - 0 ratings