jinhongyii commented on code in PR #14348:
URL: https://github.com/apache/tvm/pull/14348#discussion_r1142853740
##########
tests/python/relax/test_frontend_from_fx.py:
##########
@@ -19,20 +19,51 @@
import tvm
from tvm import relax
import tvm.testing
-from tvm.script.parser import ir as I, relax as R, tir as T
+from tvm.script import ir as I
+from tvm.script import relax as R
+from tvm.script import tir as T
-def verify_model(torch_model, input_info, binding, expected):
+def verify_model(torch_model, input_info, binding, expected, use_dynamo=False):
+ import torch
+ import torch._dynamo as dynamo
from torch import fx
from tvm.relax.frontend.torch import from_fx
- graph_model = fx.symbolic_trace(torch_model)
- mod = from_fx(graph_model, input_info)
+ if use_dynamo:
+ args = []
+ for info in input_info:
+ args.append(torch.zeros(*info[0],
dtype=_convert_data_type(info[1])))
+ graph_model = dynamo.export(torch_model, *args)[0]
+ else:
+ graph_model = fx.symbolic_trace(torch_model)
+ print(graph_model.code)
+ mod = from_fx(graph_model, input_info, unwrap_unit_return_tuple=True)
Review Comment:
maybe I can add a param to decide whether to turn on
unwrap_unit_return_tuple for now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]