From: Haichen Shen Date: Fri, 17 Jul 2020 16:13:19 +0000 (-0700) Subject: [Test] Add missing test for fast erf (#6058) X-Git-Tag: upstream/0.7.0~387 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c12a5e9cd8c242fa843be1e6d5cad5059ff7c3d;p=platform%2Fupstream%2Ftvm.git [Test] Add missing test for fast erf (#6058) * add missing test for fast erf * trigger ci --- 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()