title: Error: 'NoneType' object has no attribute '_inbound_nodes' while concatenating layers (Multi-input model)
body: <p>I am fairly new to deep learning and neural networks.</p>
  
  <p>I have a dataset with text and numeric features and I am trying to solve this problem with a method given <a href="http://digital-thinking.de/deep-learning-combining-numerical-and-text-features-in-deep-neural-networks/" rel="nofollow noreferrer">here</a></p>
  
  <p>I split the dataset into two with textual(X_text) and numerical(X_num) features. I added all the columns in the text(X_text) into a single column, dropped the other columns. Then I ran TfidfVectorizer on this column and transformed it to an array with has a shape (1905, 20859). X_num has a shape of (1905,34)</p>
  
  <p>The code I used after this</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense, Embedding, Flatten, LSTM, Input, Bidirectional, Concatenate
  from keras.optimizers import adam
  from keras import regularizers
  from keras.backend import concatenate
  from keras import Model
  
  nlp_input = Input(shape=(20860,))
  meta_input = Input(shape=(35,))
  emb = Embedding(output_dim=32, input_dim=20859)(nlp_input)
  nlp_output = Bidirectional(LSTM(128, dropout=0.3, recurrent_dropout=0.3, kernel_regularizer=regularizers.l2(0.01)))(emb)
  x = concatenate([nlp_out, meta_input])
  layer1 = Dense(32, activation='relu')(x)
  layer2 = Dense(1, activation='sigmoid')(layer1)
  model = Model(inputs=[nlp_input , meta_input], outputs=layer2)
  optimizer=adam(lr=0.00001)
  model.compile(optimizer=optimizer, loss='binary_crossentropy', metrics = ['binary_accuracy'])
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>    Traceback (most recent call last)
          &lt;ipython-input-51-d98028f8916d&gt; in &lt;module&gt;
               13 layer1 = Dense(32, activation='relu')(x)
               14 layer2 = Dense(1, activation='sigmoid')(layer1)
          ---&gt; 15 model = Model(inputs=[nlp_input , meta_input], outputs=layer2)
  
          /anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
               89                 warnings.warn('Update your `' + object_name + '` call to the ' +
               90                               'Keras 2 API: ' + signature, stacklevel=2)
          ---&gt; 91             return func(*args, **kwargs)
               92         wrapper._original_function = func
               93         return wrapper
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in __init__(self, *args, **kwargs)
               91                 'inputs' in kwargs and 'outputs' in kwargs):
               92             # Graph network
          ---&gt; 93             self._init_graph_network(*args, **kwargs)
               94         else:
               95             # Subclassed network
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in _init_graph_network(self, inputs, outputs, name)
              229         # Keep track of the network's nodes and layers.
              230         nodes, nodes_by_depth, layers, layers_by_depth = _map_graph_network(
          --&gt; 231             self.inputs, self.outputs)
              232         self._network_nodes = nodes
              233         self._nodes_by_depth = nodes_by_depth
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in _map_graph_network(inputs, outputs)
             1364                   layer=layer,
             1365                   node_index=node_index,
          -&gt; 1366                   tensor_index=tensor_index)
             1367 
             1368     for node in reversed(nodes_in_decreasing_depth):
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in build_map(tensor, finished_nodes, nodes_in_progress, layer, node_index, tensor_index)
             1351             tensor_index = node.tensor_indices[i]
             1352             build_map(x, finished_nodes, nodes_in_progress, layer,
          -&gt; 1353                       node_index, tensor_index)
             1354 
             1355         finished_nodes.add(node)
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in build_map(tensor, finished_nodes, nodes_in_progress, layer, node_index, tensor_index)
             1351             tensor_index = node.tensor_indices[i]
             1352             build_map(x, finished_nodes, nodes_in_progress, layer,
          -&gt; 1353                       node_index, tensor_index)
             1354 
             1355         finished_nodes.add(node)
  
          /anaconda3/lib/python3.6/site-packages/keras/engine/network.py in build_map(tensor, finished_nodes, nodes_in_progress, layer, node_index, tensor_index)
             1323             ValueError: if a cycle is detected.
             1324         """
          -&gt; 1325         n
  
  ode = layer._inbound_nodes[node_index]
         1326 
         1327         # Prevent cycles.
  
      AttributeError: 'NoneType' object has no attribute '_inbound_nodes'
  </code></pre>
  
  <p>I read in other places that a Lambda layer can be used which using functions as layers in keras and maybe this is where the problem originates. But I don't have a function to call as far as I can see. Any idea how to fix this?</p>