This is an automated email from the ASF dual-hosted git repository.
ruihangl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 3bc61d1fab [BugFix][TOPI] Fix get_const_tuple hanging indefinitely
when passed a te.Tensor (#19380)
3bc61d1fab is described below
commit 3bc61d1fab71fbcebbb82c6507d6ba6684465fdb
Author: Shushi Hong <[email protected]>
AuthorDate: Fri Apr 10 14:51:39 2026 -0400
[BugFix][TOPI] Fix get_const_tuple hanging indefinitely when passed a
te.Tensor (#19380)
This pr fixes #18765: `topi.get_const_tuple` hangs indefinitely when
passed a `te.Tensor` instead of a shape tuple and adds a type check to
raise a clear `TypeError` with a helpful message suggesting
`get_const_tuple(tensor.shape)` instead
---
python/tvm/topi/utils.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/python/tvm/topi/utils.py b/python/tvm/topi/utils.py
index c660fa65ce..23ead47ae6 100644
--- a/python/tvm/topi/utils.py
+++ b/python/tvm/topi/utils.py
@@ -186,6 +186,11 @@ def get_const_tuple(in_tuple):
out_tuple : tuple of int
The output.
"""
+ if isinstance(in_tuple, te.tensor.Tensor):
+ raise TypeError(
+ f"get_const_tuple expects a tuple-like shape (e.g., tensor.shape),
"
+ f"but got a te.Tensor. Did you mean get_const_tuple(tensor.shape)?"
+ )
ret = []
ana = None
for elem in in_tuple: