7 onnx_model = onnx.load(
'lenet.onnx')
9 input_name =
'import/Placeholder:0' 10 input_shape = (1,1,28,28)
11 shape_dict = {input_name: input_shape}
13 mod, params = relay.frontend.from_onnx(model=onnx_model, shape=shape_dict)
17 with relay.build_config(opt_level=opt_level):
18 graph, lib, params = relay.build_module.build(mod, target, params=params)
21 out_lib = open(
"lenet.ll",
"w")
22 out_graph = open(
"lenet.json",
"w")
23 out_params = open(
"lenet.params",
"w")
24 out_lib.write(lib.get_source())
26 out_graph.write(graph)