Skip to content

Commit

Permalink
[REFACTOR][PY][API-CHANGE] establish tvm.ir, migrate corresponding fi…
Browse files Browse the repository at this point in the history
…les (apache#4862)

* [REFACTOR][PY][API-CHANGE] establish tvm.ir, migrate corresponding relay files.

This PR establishes tvm.ir and migrates the corresponding relay
files into the new folder.

API Change:
- relay.Module -> tvm.IRModule

* Update with ADT

* Migrate transform

* address comments

* Migrate module

* Migrate json_compact

* Migrate attrs

* Move LoweredFunc to stmt temporarily

* temp migrate container

* Finish migrate container
  • Loading branch information
tqchen committed Feb 12, 2020
1 parent 651bdc4 commit 36e08ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/vta/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def early_rewrite(stmt):
"""Try to do storage rewrite in early pass."""
try:
return tvm.ir_pass.StorageRewrite(stmt)
except tvm.TVMError:
except tvm.error.TVMError:
return stmt


Expand Down
3 changes: 2 additions & 1 deletion python/vta/top/graphpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
# pylint: disable=unused-argument
"""A Relay implementation of graph packing."""

import tvm
from tvm import relay
from tvm.relay import op, transform
from tvm.relay import ExprMutator

def run_opt_pass(expr, opt_pass):
"""Exectue a relay pass."""
assert isinstance(opt_pass, transform.Pass)
mod = relay.Module.from_expr(expr)
mod = tvm.IRModule.from_expr(expr)
mod = opt_pass(mod)
entry = mod["main"]
return entry if isinstance(expr, relay.Function) else entry.body
Expand Down
2 changes: 1 addition & 1 deletion tutorials/autotvm/tune_relay_vta.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def tune_and_evaluate(tuning_opt):
# Perform task extraction on Relay program
print("Extract tasks...")
relay_prog, params = compile_network(env, target, network, start_pack, stop_pack)
mod = relay.Module.from_expr(relay_prog)
mod = tvm.IRModule.from_expr(relay_prog)
tasks = autotvm.task.extract_from_program(mod,
params=params,
ops=(tvm.relay.op.nn.conv2d, ),
Expand Down

0 comments on commit 36e08ac

Please sign in to comment.