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


##########
python/tvm/tir/op.py:
##########
@@ -2116,6 +2116,8 @@ def exp(x):
         The result.
     """
     x = tir.convert(x)
+    if "int" in x.dtype:
+        x = tir.Cast("float64", x)

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The current check `if "int" in x.dtype:` is fragile as it only handles 
signed integer types. It will not correctly handle unsigned integer types 
(e.g., `uint32`) or boolean types (`bool`), which should also be cast to float 
for the `exp` operation. A more robust approach is to use `tvm.DataType` to 
check if the dtype is any integer type (signed or unsigned). This ensures all 
relevant integer-like types are correctly handled.
   
   ```suggestion
       if tvm.DataType(x.dtype).is_int() or tvm.DataType(x.dtype).is_uint():
           x = tir.Cast("float64", x)
   ```



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

Reply via email to