Skip to content

Commit

Permalink
pdate test
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Sep 21, 2022
1 parent 32db8ea commit 1e80481
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions tests/python/contrib/test_hexagon/test_meta_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,20 +373,11 @@ def test_conv2d_relay_auto_schedule(hexagon_launcher):
bias_np = np.random.randn(*bias_shape).astype("float16")
params = {"weight": weight_np, "bias": bias_np}

target_llvm = tvm.target.Target("llvm")

with tvm.transform.PassContext(
opt_level=3,
):
lib_ref = relay.build(mod, target=target_llvm, params=params)

rt_mod_ref = tvm.contrib.graph_executor.GraphModule(lib_ref["default"](tvm.cpu(0)))

rt_mod_ref.set_input("data", data_np)

rt_mod_ref.run()

ref = rt_mod_ref.get_output(0).numpy()
ref = (
relay.create_executor("graph", mod=mod, device=tvm.cpu(0), target="llvm")
.evaluate()(*[data_np, weight_np, bias_np])
.numpy()
)

config = ms.TuneConfig(
strategy="replay_trace",
Expand Down Expand Up @@ -416,4 +407,6 @@ def test_conv2d_relay_auto_schedule(hexagon_launcher):
rt_mod.run()

out = rt_mod.get_output(0).numpy()
print(np.max(np.abs(ref - out)), np.mean(np.abs(ref - out)))

# fp16 results between x86 and Hexagon are non-trivially different
assert np.mean(np.abs(ref - out)) < 0.5

0 comments on commit 1e80481

Please sign in to comment.