(text_inputs, vocab_size, embedding_size)
return embedding_chars_expanded
Embedding layer.
Embedding layer.
Embedding layer .
def embedding_look_up(text_inputs, vocab_size, embedding_size):
  """Embedding layer."""
  with tf.variable_scope("embedding"):
    W = tf.get_variable(
        name='W',
        initializer=tf.random_uniform([vocab_size, embedding_size], -1.0, 1.0))
    embedding_chars = tf.nn.embedding_lookup(W, text_inputs)
    embedding_chars_expanded = tf.expand_dims(embedding_chars, -1)
  return embedding_chars_expanded
def embedding_look_up ( text_inputs , vocab_size , embedding_size ) : with tf . variable_scope ( "embedding" ) : W = tf . get_variable ( name = 'W' , initializer = tf . random_uniform ( [ vocab_size , embedding_size ] , - 1.0 , 1.0 ) ) embedding_chars = tf . nn . embedding_lookup ( W , text_inputs ) embedding_chars_expanded = tf . expand_dims ( embedding_chars , - 1 ) return embedding_chars_expanded