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


##########
python/tvm_ffi/cython/dtype.pxi:
##########
@@ -172,8 +172,11 @@ if torch is not None:
         torch.float8_e4m3fnuz: DLDataType(11, 8, 1),
         torch.float8_e5m2: DLDataType(12, 8, 1),
         torch.float8_e5m2fnuz: DLDataType(13, 8, 1),
-        torch.float8_e8m0fnu: DLDataType(14, 8, 1),
     }
+    if hasattr(torch, "float8_e8m0fnu"):
+        TORCH_DTYPE_TO_DTYPE[torch.float8_e8m0fnu] = DLDataType(14, 8, 1)
+    if hasattr(torch, "float4_e2m1fn_x2"):
+        TORCH_DTYPE_TO_DTYPE[torch.float8_e8m0fnu] = DLDataType(17, 4, 2)

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   There appears to be a copy-paste error here. The dictionary key should be 
`torch.float4_e2m1fn_x2`, but `torch.float8_e8m0fnu` is used instead. This will 
cause the mapping for `float8_e8m0fnu` to be overwritten if 
`torch.float4_e2m1fn_x2` exists, and `float4_e2m1fn_x2` will not be registered 
correctly.
   
   ```
           TORCH_DTYPE_TO_DTYPE[torch.float4_e2m1fn_x2] = DLDataType(17, 4, 2)
   ```



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