Hi I just started to learn TVM and noted that some code in FCRC [TVM For Fun and Profit Tutorial, ISCA 2019, June 22nd 2019, Phoenix] workshop are too old to run with lastest tvm (0.8_dev) So I put the fix here for any starter learners.
(1) relay.Module not exist
instead use:
mod = tvm.IRModule({})
(2) get params from IRModule changed (in inline_parameters)
Should use expr[‘main’] instead of expr
param_map = dict((p.name_hint, p) for p in expr["main"].params)
params = dict((param_map[k], relay.const(params[k])) for k in params)
(3) relay.ir_pass is moved to relay.analysis
relay.Function(relay.analysis.free_vars(new_body), new_body)
(4) relay.create_executor(‘vm’, mod) does not contain ‘main’ variable
good example should be(add a valid main func in IRModule):
ix = relay.var('x', shape=(10, 1))
z = x + x
mod = tvm.IRModule({})
fname = relay.GlobalVar('main')
mod[fname] = relay.Function([x], z)