title: Keras embedding layer with variable length in functional API
body: <p>I have the following sequential model that works with variable length inputs:</p>
  
  <pre><code>m = Sequential()
  m.add(Embedding(len(chars), 4, name="embedding"))
  m.add(Bidirectional(LSTM(16, unit_forget_bias=True, name="lstm")))
  m.add(Dense(len(chars),name="dense"))
  m.add(Activation("softmax"))
  m.summary()
  </code></pre>
  
  <p>Gives the following summary:</p>
  
  <pre><code>_________________________________________________________________
  Layer (type)                 Output Shape              Param #   
  =================================================================
  embedding (Embedding)        (None, None, 4)           204       
  _________________________________________________________________
  bidirectional_2 (Bidirection (None, 32)                2688      
  _________________________________________________________________
  dense (Dense)                (None, 51)                1683      
  _________________________________________________________________
  activation_2 (Activation)    (None, 51)                0         
  =================================================================
  Total params: 4,575
  Trainable params: 4,575
  Non-trainable params: 0
  </code></pre>
  
  <p>However when I try to implement the same model in functional API I don't know whatever I try as Input layer shape doesn't seem to be the same as the sequential model. Here is one of my tries:</p>
  
  <pre><code>charinput = Input(shape=(4,),name="input",dtype='int32')
  embedding = Embedding(len(chars), 4, name="embedding")(charinput)
  lstm = Bidirectional(LSTM(16, unit_forget_bias=True, name="lstm"))(embedding)
  dense = Dense(len(chars),name="dense")(lstm)
  output = Activation("softmax")(dense)
  </code></pre>
  
  <p>And here is the summary:</p>
  
  <pre><code>_________________________________________________________________
  Layer (type)                 Output Shape              Param #   
  =================================================================
  input (InputLayer)           (None, 4)                 0         
  _________________________________________________________________
  embedding (Embedding)        (None, 4, 4)              204       
  _________________________________________________________________
  bidirectional_1 (Bidirection (None, 32)                2688      
  _________________________________________________________________
  dense (Dense)                (None, 51)                1683      
  _________________________________________________________________
  activation_1 (Activation)    (None, 51)                0         
  =================================================================
  Total params: 4,575
  Trainable params: 4,575
  Non-trainable params: 0
  </code></pre>