From 1da54d35cd83191143a16a14f1c96c5813baa354 Mon Sep 17 00:00:00 2001 From: Steven Lyubomirsky Date: Mon, 9 Jan 2023 15:11:24 -0500 Subject: [PATCH] erase_to_well_defined should handle unbound shape vars in FuncStructInfo --- relax_spec.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/relax_spec.md b/relax_spec.md index b7f5a867ff..164b0e31b5 100644 --- a/relax_spec.md +++ b/relax_spec.md @@ -657,13 +657,17 @@ def erase_to_well_defined( ) if s is FuncStructInfo: if params is defined: - return FuncStructInfo( - params=[ - erase_to_well_defined(param, var_scope, shape_var_scope) - for param in s.params - ], + new_params = [] + for param in s.params: + if param contains unbound shape variables: + insert unbound shape variables into shape_var_scope + new_params.append(erase_to_well_defined(param, var_scope, shape_var_scope)) + ret = FuncStructInfo( + params=new_params, ret=erase_to_well_defined(s.ret, var_scope, shape_var_scope) ) + remove any unbound shape variables added into shape_var_scope above + return ret else: return FuncStructInfo( ret=erase_to_well_defined(s.ret, var_scope, shape_var_scope),