title: How to freeze a keras model and train it with tensorflow?
body: <p>I build a model with Keras and try to freeze the Embedding layer (set Trainable=False), then I use Tensorflow to train the model. However, the Embedding layer is still trainable. The full code is as follows:</p>
  
  <pre><code>sen_input = Input(shape=(maxlen,), name='sen_input')
  emb = Embedding(embedding.shape[0], embedding.shape[1], weights=[embedding], trainable=False, name='emb')
  
  x = emb(sen_input)
  pred = Dense(num_classes, activation='softmax', name='pred')(x)
  
  
  loss = -K.sum(x * K.log(pred + K.epsilon()), axis=-1)
  train_step = tf.train.AdamOptimizer(0.001).minimize(loss)
  
  config = tf.ConfigProto()
  config.gpu_options.allow_growth = True
  sess = tf.Session(config=config)
  init = tf.global_variables_initializer()
  sess.run(init)
  
  </code></pre>
  
  <p>Any idea to help?</p>