From 3c12a5e9cd8c242fa843be1e6d5cad5059ff7c3d Mon Sep 17 00:00:00 2001 From: Haichen Shen Date: Fri, 17 Jul 2020 09:13:19 -0700 Subject: [PATCH] [Test] Add missing test for fast erf (#6058) * add missing test for fast erf * trigger ci --- tests/python/relay/test_pass_fast_math.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/python/relay/test_pass_fast_math.py b/tests/python/relay/test_pass_fast_math.py index 93ad034..da5eaf4 100644 --- a/tests/python/relay/test_pass_fast_math.py +++ b/tests/python/relay/test_pass_fast_math.py @@ -47,6 +47,21 @@ def test_tanh(): fast_mod = relay.optimize(mod, target='llvm', params=None) assert "fast_tanh" in fast_mod[0].astext() +def test_erf(): + x = relay.var("x", shape=(1, 16, 16, 16), dtype="float32") + y = relay.erf(x) + func = relay.Function([x], y) + mod = tvm.IRModule.from_expr(func) + + fast_mod = FastMath()(mod) + assert "fast_erf" in fast_mod.astext() + + # Check that FastMath option works for relay.build. + with tvm.transform.PassContext(opt_level=3, required_pass=['FastMath']): + fast_mod = relay.optimize(mod, target='llvm', params=None) + assert "fast_erf" in fast_mod[0].astext() + if __name__ == "__main__": test_exp() test_tanh() + test_erf() -- 2.7.4