title: Concatenate Embedding layers
body: <p>I'm trying to create a model which has words as inputs. Most of those words are in the glove word vector set (~50000). However, some of the frequent words are not (~1000). The question is, how do I concatenate the following two embedding layers to create one giant <code>Embedding</code> lookup table?</p>
  
  <pre><code>trained_em = Embedding(50000, 50, 
                         weights=np.array([word2glove[w] for w in words_in_glove]), 
                         trainable=False)
  untrained_em = Embedding(1000, 50)
  </code></pre>
  
  <p>As far as I understand these are simply two lookup tables with same number of dimensions. So I'm hoping that there is a way to stack these two lookup tables.</p>
  
  <p><strong>Edit 1:</strong>
  I just realised that this is probably going to be more than stacking <code>Embedding</code> layers because the input sequence would be a number from <code>0-50999</code>. However <code>untrained_em</code> above only expect a number from <code>0-999</code>. So perhaps a different solution is required.</p>
  
  <p><strong>Edit 2:</strong>
  This is what I would expect to do in a numpy array representing the Embedding:</p>
  
  <pre><code>np.random.seed(42) # Set seed for reproducibility
  pretrained = np.random.randn(15,3)
  untrained = np.random.randn(5,3)
  final_embedding = np.vstack([pretrained, untrained])
  
  word_idx = [2, 5, 19]
  np.take(final_embedding, word_idx, axis=0)
  </code></pre>
  
  <p>I believe the last bit can be done with something to do with <code>keras.backend.gather</code> but not sure how to put it all together.</p>