PandA-2024.02
01_tvm_compile.py
Go to the documentation of this file.
1 import numpy as np
2 import onnx
3 import onnxruntime
4 
5 from tvm import relay
6 import tvm
7 
8 onnx_model = onnx.load('01_vecmul_a.onnx')
9 
10 input_name1 = 'X'
11 input_shape1 = (1,8)
12 input_name2 = 'Y'
13 input_shape2 = (1,8)
14 shape_dict = {input_name1: input_shape1, input_name2: input_shape2}
15 
16 
17 mod, params = relay.frontend.from_onnx(model=onnx_model, shape=shape_dict)
18 
19 
20 # Compilation
21 opt_level = 3
22 target = 'llvm'
23 with relay.build_config(opt_level=opt_level):
24  graph, lib, params = relay.build_module.build(
25  mod, target, params=params)
26 
27 
28 #printing some LLVM code
29 out_file = open("01_vecmul_a.ll", "w")
30 out_file.write(lib.get_source())
31 out_file.close()
32 
33 

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