title: Keras - All layer names should be unique
body: <p>I combine two VGG net in keras together to make classification task. When I run the program, it shows an error:</p>
  
  <blockquote>
    <p>RuntimeError: The name "predictions" is used 2 times in the model. All layer names should be unique.</p>
  </blockquote>
  
  <p>I was confused because I only use <code>prediction</code> layer once in my code:</p>
  
  <pre><code>from keras.layers import Dense
  import keras
  from keras.models import  Model
  model1 = keras.applications.vgg16.VGG16(include_top=True, weights='imagenet',
                                  input_tensor=None, input_shape=None,
                                  pooling=None,
                                  classes=1000)
  model1.layers.pop()
  
  model2 =  keras.applications.vgg16.VGG16(include_top=True, weights='imagenet',
                                  input_tensor=None, input_shape=None,
                                  pooling=None,
                                  classes=1000)
  model2.layers.pop()
  for layer in model2.layers:
      layer.name = layer.name + str("two")
  model1.summary()
  model2.summary()
  featureLayer1 = model1.output
  featureLayer2 = model2.output
  combineFeatureLayer = keras.layers.concatenate([featureLayer1, featureLayer2])
  prediction = Dense(1, activation='sigmoid', name='main_output')(combineFeatureLayer)
  
  model = Model(inputs=[model1.input, model2.input], outputs= prediction)
  model.summary()
  </code></pre>
  
  <p>Thanks for @putonspectacles help, I follow his instruction and find some interesting part. If you use <code>model2.layers.pop()</code> and combine the last layer of two models using "<code>model.layers.keras.layers.concatenate([model1.output, model2.output])</code>", you will find that the last layer information is still showed using the <code>model.summary()</code>. But actually they do not exist in the structure. So instead, you can use <code>model.layers.keras.layers.concatenate([model1.layers[-1].output, model2.layers[-1].output])</code>. It looks tricky but it works.. I think it is a problem about synchronization of the log and structure. </p>