aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-07-10 18:39:30 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-10 18:43:01 -0700
commitaa239529c47c09599d1085791fc849f03efbddfe (patch)
tree0b06b956c810e02b5334397a98ab4f5364c6d648
parent7624e8e9336e9b9f9a066292b11cf75f8fdeea05 (diff)
[XLA] Fix bugs and incomplete comment in reduce_precision_test.cc.
We want a bitwise or, not bitwise and, to add in the sign bit. This was previously just creating zeros instead of negative test values. PiperOrigin-RevId: 161473273
-rw-r--r--tensorflow/compiler/xla/tests/reduce_precision_test.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/compiler/xla/tests/reduce_precision_test.cc b/tensorflow/compiler/xla/tests/reduce_precision_test.cc
index a66c9b4487..48212dc7d1 100644
--- a/tensorflow/compiler/xla/tests/reduce_precision_test.cc
+++ b/tensorflow/compiler/xla/tests/reduce_precision_test.cc
@@ -214,11 +214,12 @@ XLA_TEST_P(ReducePrecisionTest, ReducePrecisionF32) {
// Add positive values.
input_values.push_back(tensorflow::bit_cast<float>(test_value[0]));
expected_values.push_back(tensorflow::bit_cast<float>(test_value[index]));
- // Add negative values. We do this in the
+ // Add negative values. We do this in the bitwise representation so as to
+ // avoid problems with NaN handling.
input_values.push_back(
- tensorflow::bit_cast<float>(test_value[0] & sign_bit));
+ tensorflow::bit_cast<float>(test_value[0] ^ sign_bit));
expected_values.push_back(
- tensorflow::bit_cast<float>(test_value[index] & sign_bit));
+ tensorflow::bit_cast<float>(test_value[index] ^ sign_bit));
}
// This is required for proper handling of NaN values.