tqchen commented on code in PR #16757:
URL: https://github.com/apache/tvm/pull/16757#discussion_r1536886548
##########
python/tvm/relax/frontend/nn/exporter.py:
##########
@@ -176,35 +183,26 @@ def _unwrap_ret(expr: typing.Any) -> typing.Any:
def _convert_input(arg):
if isinstance(arg, tir.Var):
return rx.Var(arg.name, struct_info=ShapeStructInfo(values=[arg]))
- if isinstance(arg, (core.Tensor, core.Object)):
+ elif isinstance(arg, (core.Tensor, core.Object)):
return arg._expr # pylint: disable=protected-access
- if isinstance(arg, _spec.Tuple):
+ elif isinstance(arg, _spec.Tuple):
return rx.Var(
arg.name,
struct_info=TupleStructInfo(
[_convert_input(arg_i).struct_info for arg_i in
arg.elements]
),
)
- raise TypeError(f"Unsupported input type: {type(arg)}")
+ elif isinstance(arg, rx.Expr):
+ return arg
+ else:
+ raise TypeError(f"Unsupported input type: {type(arg)}")
def _params(mode: str) -> typing.List[rx.Var]:
inputs: typing.List[rx.Var] = []
- def _get_var(shape_var: tir.Var) -> tir.Var:
- name = shape_var.name
- if name in str2var_params:
- return str2var_params[name]
Review Comment:
having ability to have common dynamic variables like `vocab_size` is a
pretty common ndeed, so likely we will need to support this behavior.
--
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]