PandA-2024.02
i2_tvm_compile.py
Go to the documentation of this file.
1 import tvm
2 import tvm.relay as relay
3 import numpy as np
4 import onnx
5 
6 onnx_model = onnx.load('i2_zfnet.onnx')
7 in_shape = (1,3,224,224)
8 shape_dict = {'gpu_0/data_0': in_shape}
9 mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
10 
11 target = 'llvm'
12 with relay.build_config(opt_level=0):
13  graph, lib, params = relay.build(mod, target, params=params)
14 
15 out_lib = open("i2_zfnet.ll", "w")
16 out_lib.write(lib.get_source())
17 out_lib.close()
18 out_graph = open("i2_zfnet.json", "w")
19 out_params = open("i2_zfnet.params", "w")
20 out_graph.write(graph)
21 out_graph.close()
22 print(params, file=out_params)
23 out_params.close()
void print(int x)

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13