Skip to content

Commit f8aa9bd

Browse files
committed
improve test
1 parent f8b6b18 commit f8aa9bd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/scalar/test_loop.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,16 @@ def test_inner_composite(mode):
213213
assert y16.type.dtype == "float16"
214214

215215
fn16 = function([n_steps, x16], y16, mode=mode)
216-
out16 = fn16(n_steps=9, x16=np.array(4.73, dtype="float16"))
217-
assert out16.dtype == "float16"
216+
out16 = fn16(n_steps=3, x16=np.array(4.73, dtype="float16"))
217+
np.testing.assert_allclose(
218+
out16,
219+
4.73 + 3,
220+
rtol=1e-3,
221+
)
222+
out16overflow = fn16(n_steps=9, x16=np.array(4.73, dtype="float16"))
223+
assert out16overflow.dtype == "float16"
218224
# with this dtype overflow happens
219-
assert np.isnan(out16)
225+
assert np.isnan(out16overflow)
220226

221227

222228
@mode

0 commit comments

Comments
 (0)