tvm
tvm copied to clipboard
Saving the compiled graph
Hi,
I have two questions:
- How to save the compiled graph? Does saving the compiled graph save the tvm::CompilationGroup symbols along with the compiled subgraphs? I hope it will not re-compile while loading the saved graph/ScriptModule.
- I am facing an issue in the basic test with the HEAD. Any ideas what is going wrong?
Appreciate your help
import torch
import torch_tvm
shape = 8
x = torch.rand(shape)
y = torch.rand(shape)
z = torch.rand(shape)
def add(a, b, c):
return a + b + c
inputs = [x, y, z]
torch_tvm.enable()
trace_tvm = torch.jit.trace(add, inputs)
relay_graph = torch_tvm.to_relay(trace_tvm, inputs)
print(relay_graph)
Traceback (most recent call last):
File "basic_tvm.py", line 18, in
File "/root/inferentia/tvm/torch_tvm/init.py", line 18, in to_relay handle = _push_relay_expr(pt_func.graph_for(*inputs), inputs)
RuntimeError: This program cannot be exported as a single Relay expression. (operator() at /root/inferentia/tvm/torch_tvm/register.cpp:53)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits
Hey, you've certainly caught a bug. Would you mind printing trace_tvm.graph
?
Generally, to use the to_relay
API, you'll need the entire graph representable in relay (note the error message) -- which doesn't seem to be the case here. (The bug is that we should be handling that graph.)