def get_params(self, trainable=False, scope="embedding", reuse=False):
    """Returns a variable with the embeddings and a scaffold to initialize them.

    Args:
      trainable: Boolean indicating whether the params should be trainable.
      scope: The name of the inner-most scope for the params.
      reuse: Boolean indicating whether to reuse params in the same scope.

    Returns:
      embedding_weights: The embedding weights.
      embedding_scaffold: A tf.train.Scaffold to be passed to the EstimatorSpec,
          which will initialize embedding_weights correctly.
    """
    with tf.variable_scope(scope, reuse=reuse):
      embedding_weights = tf.get_variable(
          "embedding_weights",
          shape=[len(self._idx2emb), self._dims],
          trainable=trainable)

    # Use a placeholder for initialization to keep the pretrained embeddings
    # out of the TensorFlow graph.
    pretrained_placeholder = tf.placeholder(
        tf.float32, [len(self._idx2emb), self._dims])
    initialize_op = tf.assign(embedding_weights, pretrained_placeholder)

    def _init_fn(_, session):
      session.run(initialize_op, feed_dict={
          pretrained_placeholder: self._idx2emb
      })

    embedding_scaffold = tf.train.Scaffold(init_fn=_init_fn)

    return embedding_weights, embedding_scaffold
Returns a variable with the embeddings and a scaffold to initialize them.

    Args:
      trainable: Boolean indicating whether the params should be trainable.
      scope: The name of the inner-most scope for the params.
      reuse: Boolean indicating whether to reuse params in the same scope.

    Returns:
      embedding_weights: The embedding weights.
      embedding_scaffold: A tf.train.Scaffold to be passed to the EstimatorSpec,
          which will initialize embedding_weights correctly.
    
language/common/inputs/embedding_utils.py