aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/learn/text_classification_character_cnn.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/examples/learn/text_classification_character_cnn.py')
-rw-r--r--tensorflow/examples/learn/text_classification_character_cnn.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/examples/learn/text_classification_character_cnn.py b/tensorflow/examples/learn/text_classification_character_cnn.py
index 143af4f664..0c96976146 100644
--- a/tensorflow/examples/learn/text_classification_character_cnn.py
+++ b/tensorflow/examples/learn/text_classification_character_cnn.py
@@ -49,7 +49,7 @@ def char_cnn_model(features, target):
"""Character level convolutional neural network model to predict classes."""
target = tf.one_hot(target, 15, 1, 0)
byte_list = tf.reshape(
- tf.one_hot(features, 256, 1, 0), [-1, MAX_DOCUMENT_LENGTH, 256, 1])
+ tf.one_hot(features, 256), [-1, MAX_DOCUMENT_LENGTH, 256, 1])
with tf.variable_scope('CNN_Layer1'):
# Apply Convolution filtering on input sequence.
conv1 = tf.contrib.layers.convolution2d(
@@ -73,7 +73,7 @@ def char_cnn_model(features, target):
# Apply regular WX + B and classification.
logits = tf.contrib.layers.fully_connected(pool2, 15, activation_fn=None)
- loss = tf.contrib.losses.softmax_cross_entropy(logits, target)
+ loss = tf.losses.softmax_cross_entropy(target, logits)
train_op = tf.contrib.layers.optimize_loss(
loss,