aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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