def get_initialized_params(self, trainable=False, scope="embedding",
                             reuse=False):
    """Returns a variable with the embeddings.

    Unlike `get_params` this does not require running a Scaffold to initialize
    the variable, however this method is not compatible with `tf.SavedModel`
    since it uses a `tf.py_func` to initialize the embedddings variable.

    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.
    """

    # Hide `self._idx2emb` behind tf.py_func so its does not get serialized as
    # as part of the graph and blow up our log sizes.
    init_value = tf.py_func(lambda: self._idx2emb, [], tf.float32, False)
    init_value.set_shape([len(self._idx2emb), self._dims])

    with tf.variable_scope(scope, reuse=reuse):
      if trainable:
        embedding_weights = tf.get_variable(
            "embedding_weights", initializer=init_value)
      else:
        # Local variable so the embeddings won't get dumped into the checkpoints
        embedding_weights = tf.get_local_variable(
            "embedding_weights", initializer=init_value)
    return embedding_weights
Returns a variable with the embeddings.

    Unlike `get_params` this does not require running a Scaffold to initialize
    the variable, however this method is not compatible with `tf.SavedModel`
    since it uses a `tf.py_func` to initialize the embedddings variable.

    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.
    
language/common/inputs/embedding_utils.py