aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-03-18 14:29:52 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-03-18 15:46:51 -0700
commitaf6a33aa47557391b3af56372598187118caf366 (patch)
tree609b755ec0ff91c0de669426bc4d5c81719973af
parent8202d0958e6894f91ff7a397a00a192fe306eb95 (diff)
Minor simplification in Hinge prediction.
Change: 117590840
-rw-r--r--tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py b/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py
index e973a88bb7..a6da0ce5e9 100644
--- a/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py
+++ b/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py
@@ -112,12 +112,13 @@ def make_dense_variable_dict(num_dense_features, num_examples):
def get_binary_predictions_for_logistic(predictions, cutoff=0.5):
return tf.cast(
tf.greater_equal(predictions, tf.ones_like(predictions) * cutoff),
- tf.float32)
+ dtype=tf.float32)
def get_binary_predictions_for_hinge(predictions):
- all_ones = tf.ones_like(predictions)
- return tf.add(tf.sign(predictions), all_ones) / 2
+ return tf.cast(
+ tf.greater_equal(predictions, tf.zeros_like(predictions)),
+ dtype=tf.float32)
# Setup the single container shared across all tests. This is testing proper