Unverified Commit a2c7f52c by Zhi Committed by GitHub

hotfix gcn tutorial fail (#4994)

parent f63b249d
......@@ -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) "
......@@ -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) "
......
......@@ -314,7 +314,6 @@ layers.append(GraphConv(
# Analyze free variables and generate Relay function
output = layers[-1]
func = relay.Function(relay.analysis.free_vars(output), output)
######################################################################
# Compile and run with TVM
......@@ -332,9 +331,13 @@ for i in range(num_layers+1):
# 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment