You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by wu...@apache.org on 2023/09/20 18:52:11 UTC
[tvm] branch unity updated: [Unity] Keep num_input attribute after ModelBundleParams (#15789)
This is an automated email from the ASF dual-hosted git repository.
wuwei pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/unity by this push:
new 14f06adca2 [Unity] Keep num_input attribute after ModelBundleParams (#15789)
14f06adca2 is described below
commit 14f06adca29a94dbe44434c3cee050dd7f0fef1b
Author: Josh Fromm <jw...@octoml.ai>
AuthorDate: Wed Sep 20 11:52:05 2023 -0700
[Unity] Keep num_input attribute after ModelBundleParams (#15789)
Keep num_input attribute after ModelBundleParams
---
src/relax/transform/bundle_model_params.cc | 1 -
tests/python/relax/test_transform_bundle_model_params.py | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/relax/transform/bundle_model_params.cc b/src/relax/transform/bundle_model_params.cc
index 2cc8902e57..f5ee8a07ac 100644
--- a/src/relax/transform/bundle_model_params.cc
+++ b/src/relax/transform/bundle_model_params.cc
@@ -66,7 +66,6 @@ class ModelParamBundler : public ExprMutator {
var_to_expr_.Set(func->params[i], TupleGetItem(var_param_tuple, i - num_input));
}
- func = WithoutAttr(func, attr::kNumInput);
func.CopyOnWrite()->params = params;
return ExprMutator::VisitExpr_(func.get());
diff --git a/tests/python/relax/test_transform_bundle_model_params.py b/tests/python/relax/test_transform_bundle_model_params.py
index 8b0a15e647..0248c438c1 100644
--- a/tests/python/relax/test_transform_bundle_model_params.py
+++ b/tests/python/relax/test_transform_bundle_model_params.py
@@ -46,6 +46,7 @@ def test_basic():
a: R.Tensor([16], "float32"),
params: R.Tuple(R.Tensor([16], "float32"), R.Tensor([16], "float32")),
) -> R.Tensor([16], "float32"):
+ R.func_attr({"num_input": 1})
expr = a
b = params[0]
expr = R.add(expr, b)
@@ -90,6 +91,7 @@ def test_no_model_params():
c: R.Tensor([16], "float32"),
params: R.Tuple(),
) -> R.Tensor([16], "float32"):
+ R.func_attr({"num_input": 3})
expr = a
expr = R.add(expr, b)
expr = R.add(expr, c)