This is an automated email from the ASF dual-hosted git repository.
lunderberg 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 3dd9345024 [Unity] Allow name_hint in additional locations (#15027)
3dd9345024 is described below
commit 3dd93450247a21ee5255147c3068b3f35c266dab
Author: Eric Lunderberg <[email protected]>
AuthorDate: Tue Jun 6 08:56:03 2023 -0400
[Unity] Allow name_hint in additional locations (#15027)
* [Unity] Allow name_hint argument to BlockBuilder.emit_te
* [Unity][NN] Pass name_hint from nn.emit to BlockBuilder.emit
---
python/tvm/relax/block_builder.py | 3 ++-
python/tvm/relax/testing/nn.py | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/python/tvm/relax/block_builder.py
b/python/tvm/relax/block_builder.py
index fb44a3bf43..80edb31efb 100644
--- a/python/tvm/relax/block_builder.py
+++ b/python/tvm/relax/block_builder.py
@@ -437,7 +437,8 @@ class BlockBuilder(Object):
gv = relax.call_tir(te_func, (y,), R.Tensor((n + 1,),
"float32"), (n,))
return gv
"""
- return self.emit(self.call_te(func, *args, **kwargs))
+ name_hint = kwargs.pop("name_hint", "")
+ return self.emit(self.call_te(func, *args, **kwargs),
name_hint=name_hint)
def match_cast(self, value: Expr, struct_info: StructInfo) -> Var:
"""Emit a MatchCast.
diff --git a/python/tvm/relax/testing/nn.py b/python/tvm/relax/testing/nn.py
index c2acc5a229..184de0f862 100644
--- a/python/tvm/relax/testing/nn.py
+++ b/python/tvm/relax/testing/nn.py
@@ -26,8 +26,8 @@ import tvm
from tvm import relax, topi, tir
-def emit(expr: relax.Expr) -> relax.Var:
- return relax.BlockBuilder.current().emit(expr)
+def emit(expr: relax.Expr, name_hint: str = "") -> relax.Var:
+ return relax.BlockBuilder.current().emit(expr, name_hint=name_hint)
def emit_te(func: Callable, *args: Any, **kwargs: Any) -> relax.Var: