Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. x = tf.placeholder(tf.int32, [batch_size, num_steps], name='input_placeholder')
  2. y = tf.placeholder(tf.int32, [batch_size, num_steps], name='labels_placeholder')
  3.  
  4. embeddings = tf.get_variable('embedding_matrix', [num_classes, state_size])
  5. rnn_inputs = [tf.squeeze(i) for i in tf.split(1,
  6. num_steps, tf.nn.embedding_lookup(embeddings, x))]
  7.  
  8. with tf.variable_scope('softmax'):
  9. W = tf.get_variable('W', [state_size, num_classes])
  10. b = tf.get_variable('b', [num_classes], initializer=tf.constant_initializer(0.0))
  11. logits = [tf.matmul(rnn_output, W) + b for rnn_output in rnn_outputs]
  12.  
  13. y_as_list = [tf.squeeze(i, squeeze_dims=[1]) for i in tf.split(1, num_steps, y)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement