aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-23 13:09:42 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-23 13:16:00 -0700
commit2d4214415269bee2c8c98d5466c540e4004652fd (patch)
tree08e9954de2577c86d890f8fa22b956bc21cf3549 /tensorflow/core/lib
parenta473f435cf7345cb9dc2efacb471a7f318141a9b (diff)
This change makes casts to bfloat16 use rounding instead of truncation by default. The motivation is that rounding achieves better accuracy than truncation.
PiperOrigin-RevId: 209985826
Diffstat (limited to 'tensorflow/core/lib')
-rw-r--r--tensorflow/core/lib/bfloat16/bfloat16.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/tensorflow/core/lib/bfloat16/bfloat16.h b/tensorflow/core/lib/bfloat16/bfloat16.h
index d6f3f26cd5..5c917e80c1 100644
--- a/tensorflow/core/lib/bfloat16/bfloat16.h
+++ b/tensorflow/core/lib/bfloat16/bfloat16.h
@@ -61,9 +61,7 @@ struct bfloat16 {
}
B16_DEVICE_FUNC explicit bfloat16(const float v) {
- // TODO(asabne) : change the below line to
- // value = round_to_bfloat16(v).value;
- value = truncate_to_bfloat16(v).value;
+ value = round_to_bfloat16(v).value;
}
B16_DEVICE_FUNC explicit bfloat16(const double val)