Skip to content

Commit 5a3278a

Browse files
authored
Merge pull request #8 from gustavomr/master
Making compatible with TF 1.X - Update text_cnn.py
2 parents f975736 + 987d793 commit 5a3278a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text_cnn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, fil
4646

4747
# Combine all the pooled features
4848
num_filters_total = num_filters * len(filter_sizes)
49-
self.h_pool = tf.concat(3, pooled_outputs)
49+
self.h_pool = tf.concat(pooled_outputs,3)
5050
self.h_pool_flat = tf.reshape(self.h_pool, [-1, num_filters_total])
5151

5252
# Add dropout
@@ -67,7 +67,7 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, fil
6767

6868
# Calculate mean cross-entropy loss
6969
with tf.name_scope('loss'):
70-
losses = tf.nn.softmax_cross_entropy_with_logits(self.scores, self.input_y)
70+
losses = tf.nn.softmax_cross_entropy_with_logits(labels = self.input_y, logits = self.scores) # only named arguments accepted
7171
self.loss = tf.reduce_mean(losses) + l2_reg_lambda * l2_loss
7272

7373
# Accuracy

0 commit comments

Comments
 (0)