aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/learn/multiple_gpu.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/examples/learn/multiple_gpu.py')
-rw-r--r--tensorflow/examples/learn/multiple_gpu.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/tensorflow/examples/learn/multiple_gpu.py b/tensorflow/examples/learn/multiple_gpu.py
index a294950a38..3bad22ddf6 100644
--- a/tensorflow/examples/learn/multiple_gpu.py
+++ b/tensorflow/examples/learn/multiple_gpu.py
@@ -65,12 +65,8 @@ def my_model(features, labels, mode):
}
return tf.estimator.EstimatorSpec(mode, predictions=predictions)
- # Convert the labels to a one-hot tensor of shape (length of features, 3)
- # and with a on-value of 1 for each one-hot vector of length 3.
- onehot_labels = tf.one_hot(labels, 3, 1, 0)
# Compute loss.
- loss = tf.losses.softmax_cross_entropy(
- onehot_labels=onehot_labels, logits=logits)
+ loss = tf.losses.sparse_softmax_cross_entropy(labels=labels, logits=logits)
# Create training op.
if mode == tf.estimator.ModeKeys.TRAIN: