You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/09/07 07:06:38 UTC

[tvm] branch main updated: support false-positive fast math (#12702)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 291dd2f063 support false-positive fast math (#12702)
291dd2f063 is described below

commit 291dd2f06331342f5c89216d5d211cb61fe3d19f
Author: cery999 <11...@users.noreply.github.com>
AuthorDate: Wed Sep 7 15:06:31 2022 +0800

    support false-positive fast math (#12702)
---
 include/tvm/topi/elemwise.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/tvm/topi/elemwise.h b/include/tvm/topi/elemwise.h
index fc9ab13988..f26105cb18 100644
--- a/include/tvm/topi/elemwise.h
+++ b/include/tvm/topi/elemwise.h
@@ -81,7 +81,7 @@ TOPI_DECLARE_UNARY_OP(isinf);
 inline Tensor fast_tanh_float(const Tensor& in, std::string name, std::string tag) {
   // Clamp the inputs to the range [-9, 9] since anything outside
   // this range is +/-1.0f in single-precision.
-  auto x = maximum(minimum(in, make_const(in->dtype, 9.0)), make_const(in->dtype, -9.0));
+  auto x = maximum(make_const(in->dtype, -9.0), minimum(make_const(in->dtype, 9.0), in));
 
   // The monomial coefficients of the numerator polynomial (odd).
   auto alpha_1 = make_const(in->dtype, 4.89352455891786e-03);