PandA-2024.02
04_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('04_dense_a.onnx')
9 
10 input_name1 = 'X'
11 input_shape1 = (1,1)
12 shape_dict = {input_name1: input_shape1}
13 
14 
15 mod, params = relay.frontend.from_onnx(model=onnx_model, shape=shape_dict)
16 
17 
18 # Compilation
19 opt_level = 3
20 target = 'llvm'
21 with relay.build_config(opt_level=opt_level):
22  graph, lib, params = relay.build_module.build(
23  mod, target, params=params)
24 
25 
26 #printing some LLVM code
27 out_file = open("04_dense_a.ll", "w")
28 out_file.write(lib.get_source())
29 out_file.close()
30 
31 

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