Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = tf.placeholder(tf.int32, [batch_size, num_steps], name='input_placeholder')
- y = tf.placeholder(tf.int32, [batch_size, num_steps], name='labels_placeholder')
- embeddings = tf.get_variable('embedding_matrix', [num_classes, state_size])
- rnn_inputs = [tf.squeeze(i) for i in tf.split(1,
- num_steps, tf.nn.embedding_lookup(embeddings, x))]
- with tf.variable_scope('softmax'):
- W = tf.get_variable('W', [state_size, num_classes])
- b = tf.get_variable('b', [num_classes], initializer=tf.constant_initializer(0.0))
- logits = [tf.matmul(rnn_output, W) + b for rnn_output in rnn_outputs]
- 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