for i, input_idx in enumerate(node_entry["inputs"]):
input_node_entry = node_list[input_idx[0]]
input_type = input_node_entry["types"][input_idx[1]]
- if not isinstance(input_node_entry["node"], (Var, Call)):
+ if not isinstance(input_node_entry["node"], (Var, Constant, Call)):
raise RuntimeError("Graph tuner can only tune target "
"operators with input node of type "
- "relay.expr.Var or relay.expr.Call. Now "
+ "relay.expr.Var/Constant/Call. Now "
"find a target op %s with input type %s"
% (op_name, str(type(input_node_entry["node"]))))
free_var = relay.Var("var_%d" % i, input_type)
else:
node_entry["inputs"].append([in_node_idx, 0, 0])
elif isinstance(node, Constant):
- pass
+ node_entry["name"] = "Constant_" + str(node_index)
+ node_entry["types"] = [node.checked_type]
elif isinstance(node, relay.op.op.Op):
return
else:
grc.codegen(mod["main"])
# default case
compiler = relay.vm.VMCompiler()
- compiler.set_params(params)
+ if params:
+ compiler.set_params(params)
compiler.lower(mod, target=target)
# relay op -> topi compute
OP2TOPI = {
tvm.relay.op.nn.conv2d: [topi.nn.conv2d, topi.nn.depthwise_conv2d_nchw,
- topi.nn.group_conv2d_nchw, topi.nn.conv2d_NCHWc],
+ topi.nn.group_conv2d_nchw,
+ topi.nn.conv2d_NCHWc,
+ topi.nn.conv2d_NCHWc_int8],
tvm.relay.op.nn.conv2d_transpose: [topi.nn.conv2d_transpose_nchw],
tvm.relay.op.nn.dense: [topi.nn.dense],
tvm.relay.op.nn.batch_matmul: [topi.nn.batch_matmul],