Hello!
Using quite straightforward code with Relax-based API from the main branch I was able to export a *.tar archive with *.c files looking quite similar to the ones that I was getting in MLF archive obtained trough TVMC tool in microTVM. However, there are only 5 functions corresponding to conv2d layers in the C code, while the model being converted contains 7 conv2d layers. So, I wonder, if the code could be generated not fully correctly.
Is this functionality supported and maintained or located in the “gray zone” currently?
import onnx
import tvm
from tvm import relax
from tvm.relax.frontend import detach_params
from tvm.relax.frontend.onnx import from_onnx
onnx_model_path = "models/model.onnx"
onnx_model = onnx.load(onnx_model_path)
input_name = "conv_1_input"
input_shape = (1, 12, 40, 1)
shape_dict = {input_name: input_shape}
mod_from_onnx = from_onnx(onnx_model, shape_dict)
mod, params = detach_params(mod_from_onnx)
target = tvm.target.Target("c")
ex = tvm.compile(mod, target)
ex.export_library("output/model_library.tar")