title: Define custom LSTM with multiple inputs
body: <p>Following the tutorial <a href="https://keras.io/layers/writing-your-own-keras-layers/" rel="nofollow noreferrer">writing custom layer</a>, I am trying to implement a custom LSTM layer with multiple input tensors. I am providing two vectors <code>input_1</code> and <code>input_2</code> as a <code>list [input_1, input_2]</code> as suggested in the tutorial. The <a href="https://stackoverflow.com/questions/54231440/define-custom-lstm-cell-in-keras">single input code</a> is working but when I change the code for multiple inputs, its throwing the error,  </p>
  
  <pre><code>self.kernel = self.add_weight(shape=(input_shape[0][-1], self.units),
      TypeError: 'NoneType' object is not subscriptable.
  </code></pre>
  
  <p>What change I have to do to get rid of the error? Here is the modified code.</p>
  
  <pre><code>class MinimalRNNCell(keras.layers.Layer):
      def __init__(self, units, **kwargs):
          self.units = units
          self.state_size = units
          super(MinimalRNNCell, self).__init__(**kwargs)
      def build(self, input_shape):
          print(type(input_shape))
          self.kernel = self.add_weight(shape=(input_shape[0][-1], self.units),
                                        initializer='uniform',
                                        name='kernel')
          self.recurrent_kernel = self.add_weight(
              shape=(self.units, self.units),
              initializer='uniform',
              name='recurrent_kernel')
          self.built = True
      def call(self, inputs, states):
          prev_output = states[0]
          h = K.dot(inputs[0], self.kernel)
          output = h + K.dot(prev_output, self.recurrent_kernel)
          return output, [output]   
  
  # Let's use this cell in a RNN layer:
  cell = MinimalRNNCell(32)
  input_1 = keras.Input((None, 5))
  input_2 = keras.Input((None, 5))
  layer = RNN(cell)
  y = layer([input_1, input_2])
  </code></pre>