Skip to content

Commit

Permalink
[Test] Add missing test for fast erf (apache#6058)
Browse files Browse the repository at this point in the history
* add missing test for fast erf

* trigger ci
  • Loading branch information
icemelon authored and Trevor Morris committed Sep 2, 2020
1 parent 22c4b75 commit 25ec71b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/python/relay/test_pass_fast_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 25ec71b

Please sign in to comment.