Skip to content

Commit

Permalink
removed unnecessary code, added comment for rnn state usage
Browse files Browse the repository at this point in the history
  • Loading branch information
domerin0 committed Nov 8, 2016
1 parent cbfa3a6 commit ce726d3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions models/sentiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ def __init__(self, vocab_size, hidden_size, dropout,
initial_state=initial_state,
sequence_length=self.seq_lengths)

states_list = []
for state in rnn_state[-1]:
states_list.append(state)
avg_states = tf.reduce_mean(tf.pack(states_list), 0)

with tf.variable_scope("output_projection"):
W = tf.get_variable(
"W",
Expand All @@ -87,6 +82,7 @@ def __init__(self, vocab_size, hidden_size, dropout,
"b",
[self.num_classes],
initializer=tf.constant_initializer(0.1))
#we use the cell memory state for information on sentence embedding
self.scores = tf.nn.xw_plus_b(rnn_state[-1][0], W, b)
self.y = tf.nn.softmax(self.scores)
self.predictions = tf.argmax(self.scores, 1)
Expand Down

0 comments on commit ce726d3

Please sign in to comment.