title: Keras Embedding Layer: InvalidArgumentError: indices[0,0] = 740 is not in [0, 13)
body: <p>
  I get an error when training my model on an embedding layer:</p>
  
  <blockquote>
    <p>InvalidArgumentError: indices[0,0] = 740 is not in [0, 13)
         [[Node: MM_emb/Gather = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, validate_indices=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](MM_emb/embeddings/read, MM_emb/Cast)]]</p>
  </blockquote>
  
  <p>The code for the Embedding is:</p>
  
  <pre class="lang-py prettyprint-override"><code>def get_embedding(attr):
      name = str(attr)
      input_dims = len(categorical_features_mappings[attr])+1
      output_dims = category_embedding_sizes[attr]
      output_dims = (input_dims+1)//2
      if output_dims&gt;50: output_dims=50
  
      inp = Input((1,), dtype='int64', name=name+'_in')
      u = Flatten(name=name+'_flt')(Embedding(input_dims, output_dims, name=name+'_emb',  embeddings_initializer='uniform')(inp))
      return inp,u
  
  
  contin_inp = Input((len(continuous_features),), name='contin')
  contin_out = Dense(len(continuous_features) * 10, activation='relu', name='contin_d')(contin_inp)
  embeddings = [get_embedding(attr) for attr in category_embedding_sizes]
  
  x = merge([emb for inp, emb in embeddings] + [contin_out], mode='concat')
  
  x = Dropout(0.02)(x)
  x = Dense(100, activation='relu', kernel_initializer='uniform')(x)
  x = Dense(50, activation='relu', kernel_initializer='uniform')(x)
  x = Dropout(0.2)(x)
  x = Dense(1, activation='sigmoid')(x)
  
  model = Model([inp for inp,emb in embeddings] + [contin_inp], x)
  </code></pre>
  
  <p>Anyone any idea?</p>
  
  <p>Thanks!</p>