diff options
author | 2016-11-08 15:46:22 -0800 | |
---|---|---|
committer | 2016-11-08 16:35:09 -0800 | |
commit | fb60813c2f14249f316c3e535dcb994e75a6c73c (patch) | |
tree | 36ba8ca8508b091ea72d526702b8caea983c23ba | |
parent | 7f498fa85380235f4c96bbb6bc99219f13caa2be (diff) |
Use the native Eigen round() method instead of std::function<float(float)>(round) which doesn't get vectorized and doesn't compile with gcc 6.2 (see #5419)
Change: 138575304
-rw-r--r-- | tensorflow/core/kernels/quantize_op.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/core/kernels/quantize_op.cc b/tensorflow/core/kernels/quantize_op.cc index b8f0dd8642..2fdbe6ec8e 100644 --- a/tensorflow/core/kernels/quantize_op.cc +++ b/tensorflow/core/kernels/quantize_op.cc @@ -99,8 +99,8 @@ class QuantizeV2Op : public OpKernel { // Divide by (max_range - min_range) to get to [0, 1.0] // Multiply by range of T, after that shift left 1/2 range of T if // T is signed. - // Note that std::round is used to round the number before the cast. - // std::round implements "round-half-away-zero", + // Note that the number is rounded before the cast. Rounding follows the + // semantic of std::round, which implements "round-half-away-zero", // e.g., -5.5 gets rounded to -6, -5.4 goes to -5, 5.4 goes to 5, // and 5.5 goes to 6. auto o = output->template flat<T>(); @@ -113,7 +113,7 @@ class QuantizeV2Op : public OpKernel { min_range) * scale_factor - half_range_) - .unaryExpr(std::function<float(float)>(round)) + .round() .template cast<T>(); } else { // The fast path that avoids unaryExpr |