You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/04/28 22:08:30 UTC

[GitHub] [tvm] MargaretQian commented on a diff in pull request #11171: [ONNX] Fix cast op to/from bfloat16

MargaretQian commented on code in PR #11171:
URL: https://github.com/apache/tvm/pull/11171#discussion_r861345416


##########
tests/python/frontend/onnx/test_forward.py:
##########
@@ -5174,6 +5172,10 @@ def test_onnx_nodes(target, dev, onnx_test):
         # roialign results to 4 decimal places
         atol = 1e-4
 
+    if "to_BFLOAT16" in test_dir:
+        # casting to BFLOAT has a larger accuracy loss
+        atol = 1

Review Comment:
   i completely agree, the difference here seems pretty high
   
   here's what I was seeing for the difference in outputs:
   
   ```
   E       AssertionError: 
   E       Not equal to tolerance rtol=1e-05, atol=1e-05
   E       
   E       Mismatched elements: 5 / 12 (41.7%)
   E       Max absolute difference: 65535
   E       Max relative difference: 4.10620301
   E        x: array([[16117, 16117, 16127, 16209],
   E              [16112, 16209, 15959, 16185],
   E              [32704, 32640, 32640, 65408]], dtype=uint16)
   E        y: array([[16117, 16118, 16128, 16210],
   E              [16113, 16209, 15960, 16185],
   E              [32704, 32640, 32640, 65408]], dtype=uint16)
   ```
   



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org