gemini-code-assist[bot] commented on code in PR #18766:
URL: https://github.com/apache/tvm/pull/18766#discussion_r2796775072


##########
python/tvm/topi/utils.py:
##########
@@ -185,6 +185,8 @@ def get_const_tuple(in_tuple):
     out_tuple : tuple of int
         The output.
     """
+    if not isinstance(in_tuple, (tuple, list)):
+        return (in_tuple,)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This change correctly fixes the infinite recursion bug. However, it 
introduces a backward-incompatible change for `te.Tensor` inputs. Previously, 
`get_const_tuple(tensor)` would effectively process the tensor's shape. With 
this change, it will return `(tensor,)`. While the previous behavior was 
undocumented, breaking it might cause issues for existing code.
   
   To maintain backward compatibility for `te.Tensor` while still fixing the 
recursion bug for other non-tuple types like `PrimExpr`, consider handling 
`te.Tensor` as a special case. For example, you could modify the logic to be 
something like:
   
   ```python
       if not isinstance(in_tuple, (tuple, list)):
           if isinstance(in_tuple, te.Tensor):
               in_tuple = in_tuple.shape
           else:
               return (in_tuple,)
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to