title: Multi-input models using Keras (Model API)
body: <p>I've been trying to construct a multiple input model using Keras. I am coming from using the sequential model and having only one input which was fairly straight-forward. I have been looking at the documentation (<a href="https://keras.io/getting-started/functional-api-guide/" rel="noreferrer">https://keras.io/getting-started/functional-api-guide/</a>) and some answers here on StackOverflow (<a href="https://stackoverflow.com/questions/46397258/how-to-merge-sequential-models-in-keras-2-0">How to &quot;Merge&quot; Sequential models in Keras 2.0?</a>). Basically what I want is to have two inputs train one model. One input is a piece of text and the other is a set of hand-picked features that were extracted from that text. The hand-picked feature vectors are of a constant length. Below is what I've tried so far:</p>
  
  <pre><code>    left = Input(shape=(7801,), dtype='float32', name='left_input')
      left = Embedding(7801, self.embedding_vector_length, weights=[self.embeddings],
                       input_length=self.max_document_length, trainable=False)(left)
  
      right = Input(shape=(len(self.z_train), len(self.z_train[0])), dtype='float32', name='right_input')
  
      for i, filter_len in enumerate(filter_sizes):
          left = Conv1D(filters=128, kernel_size=filter_len, padding='same', activation=c_activation)(left)
          left = MaxPooling1D(pool_size=2)(left)
  
      left = CuDNNLSTM(100, unit_forget_bias=1)(left)
      right = CuDNNLSTM(100, unit_forget_bias=1)(right)
  
      left_out = Dense(3, activation=activation, kernel_regularizer=l2(l_2), activity_regularizer=l1(l_1))(left)
      right_out = Dense(3, activation=activation, kernel_regularizer=l2(l_2), activity_regularizer=l1(l_1))(right)
      for i in range(self.num_outputs):
          left_out = Dense(3, activation=activation, kernel_regularizer=l2(l_2), activity_regularizer=l1(l_1))(left_out)
          right_out = Dense(3, activation=activation, kernel_regularizer=l2(l_2), activity_regularizer=l1(l_1))(right_out)
  
      left_model = Model(left, left_out)
      right_model = Model(right, right_out)
  
      concatenated = merge([left_model, right_model], mode="concat")
      out = Dense(3, activation=activation, kernel_regularizer=l2(l_2), activity_regularizer=l1(l_1), name='output_layer')(concatenated)
  
      self.model = Model([left_model, right_model], out)
      self.model.compile(loss=loss, optimizer=optimizer, metrics=[cosine, mse, categorical_accuracy])
  </code></pre>
  
  <p>This gives the error:</p>
  
  <pre><code>TypeError: Input layers to a `Model` must be `InputLayer` objects. Received inputs: Tensor("cu_dnnlstm_1/strided_slice_16:0", shape=(?, 100), dtype=float32). Input 0 (0-based) originates from layer type `CuDNNLSTM`.
  </code></pre>