Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] Fix gcn tutorial failure #4994

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/tvm/relay/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def build(mod, target=None, target_host=None, params=None):
raise ValueError("Type of input parameter mod must be tvm.IRModule")

if isinstance(mod, _expr.Function):
if params:
mod = bind_params_by_name(mod, params)
mod = IRModule.from_expr(mod)
warnings.warn(
"Please use input parameter mod (tvm.IRModule) "
Expand Down Expand Up @@ -278,6 +280,8 @@ def optimize(mod, target=None, params=None):
raise ValueError("Type of input parameter mod must be tvm.IRModule")

if isinstance(mod, _expr.Function):
if params:
mod = bind_params_by_name(mod, params)
mod = IRModule.from_expr(mod)
warnings.warn(
"Please use input parameter mod (tvm.IRModule) "
Expand Down
7 changes: 5 additions & 2 deletions tutorials/frontend/build_gcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ def prepare_params(g, data):

# Analyze free variables and generate Relay function
output = layers[-1]
func = relay.Function(relay.analysis.free_vars(output), output)

######################################################################
# Compile and run with TVM
Expand All @@ -332,9 +331,13 @@ def prepare_params(g, data):
# Set the TVM build target
target = 'llvm' # Currently only support `llvm` as target

func = relay.Function(relay.analysis.free_vars(output), output)
func = relay.build_module.bind_params_by_name(func, params)
mod = tvm.IRModule()
mod["main"] = func
# Build with Relay
with relay.build_config(opt_level=0): # Currently only support opt_level=0
graph, lib, params = relay.build(func, target, params=params)
graph, lib, params = relay.build(mod, target, params=params)

# Generate graph runtime
ctx = tvm.context(target, 0)
Expand Down