areusch commented on code in PR #10941:
URL: https://github.com/apache/tvm/pull/10941#discussion_r847596130
##########
python/tvm/driver/tvmc/frontends.py:
##########
@@ -284,13 +285,48 @@ def load(self, path, shape_dict=None, **kwargs):
return relay.frontend.from_paddle(prog, shape_dict=shape_dict,
**kwargs)
+class RelayFrontend(Frontend):
+ """Relay frontend for TVMC"""
+
+ @staticmethod
+ def name():
+ return "relay"
+
+ @staticmethod
+ def suffixes():
+ return ["relay"]
+
+ def load(self, path, shape_dict=None, **kwargs):
+ with open(path, "r", encoding="utf-8") as relay_text:
+ text = relay_text.read()
+ if shape_dict is not None:
+ logger.warning("Supplied shape_dict argument ignored for text
frontend")
+ ir_mod = parser.fromtext(text)
+
+ def _gen_params(ir_mod):
+ """Populate the all the params in the mode with ones."""
+ main_func = ir_mod["main"]
+ shape_dict = {p.name_hint: p.checked_type.concrete_shape for p in
main_func.params}
+ type_dict = {p.name_hint: p.checked_type.dtype for p in
main_func.params}
+ params = {}
+ for name, shape in shape_dict.items():
+ data = np.ones(shape).astype(type_dict[name])
Review Comment:
oh i just read your commit note more clearly. shall we instead add a warning
perhaps so it's clear to the user how the interface is expected to work?
--
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]