ConvolutedDog commented on code in PR #19535:
URL: https://github.com/apache/tvm/pull/19535#discussion_r3218824388
##########
tests/python/relax/test_frontend_onnx.py:
##########
@@ -177,16 +180,31 @@ def _check_output(tvm_out, ort_out):
elif isinstance(tvm_out, tvm.runtime.Tensor) and isinstance(ort_out,
np.ndarray):
if check_dtypes:
assert tvm_out.numpy().dtype == ort_out.dtype
- tvm.testing.assert_allclose(tvm_out.numpy(), ort_out, rtol=rtol,
atol=atol)
+ if equal_nan:
+ np.testing.assert_allclose(
+ tvm_out.numpy(), ort_out, rtol=rtol, atol=atol,
equal_nan=True
+ )
+ else:
+ tvm.testing.assert_allclose(tvm_out.numpy(), ort_out,
rtol=rtol, atol=atol)
elif isinstance(tvm_out, tvm_ffi.Shape) and isinstance(ort_out,
np.ndarray):
shape_out = tvm.runtime.tensor([int(i) for i in tvm_out])
if check_dtypes:
assert _get_numpy_subdtype(shape_out.numpy()) ==
_get_numpy_subdtype(ort_out)
- tvm.testing.assert_allclose(shape_out.numpy(), ort_out, rtol=rtol,
atol=atol)
+ if equal_nan:
+ np.testing.assert_allclose(
+ shape_out.numpy(), ort_out, rtol=rtol, atol=atol,
equal_nan=True
+ )
+ else:
+ tvm.testing.assert_allclose(shape_out.numpy(), ort_out,
rtol=rtol, atol=atol)
elif isinstance(tvm_out, int | float | bool) and isinstance(ort_out,
np.ndarray):
if check_dtypes:
assert _get_numpy_subdtype(np.array(tvm_out)) ==
_get_numpy_subdtype(ort_out)
- tvm.testing.assert_allclose(np.array(tvm_out), ort_out, rtol=rtol,
atol=atol)
+ if equal_nan:
+ np.testing.assert_allclose(
+ np.array(tvm_out), ort_out, rtol=rtol, atol=atol,
equal_nan=True
+ )
+ else:
+ tvm.testing.assert_allclose(np.array(tvm_out), ort_out,
rtol=rtol, atol=atol)
Review Comment:
Addressed in
https://github.com/apache/tvm/pull/19535/changes/c6c1e49defca1aa6dd348c57595e1bf8926aa301
--
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]