Skip to content

Commit

Permalink
just test of idiv-0
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyuxyz committed Dec 10, 2024
1 parent f83d715 commit 1ded938
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ def test_div_int(self):
if is_dtype_supported(dtypes.uint64):
x = Tensor(2**64 - 1, dtype=dtypes.uint64).idiv(1)
np.testing.assert_equal(x.numpy(), 2**64 - 1)
# 1 // 0 is device dependent, but it should not raise
Tensor([1]).idiv(1).realize()
if not (CI and (Device.DEFAULT=="LLVM" or getenv("PTX"))): # TODO: crashed in CI
# ... because if might be in a where branch that the output is well defined
t = Tensor([-1, 0, 1, 2])
np.testing.assert_equal((t > 0).where(1//t, t).numpy(), [-1, 0, 1, 0])

def test_scalar_div(self):
helper_test_op([(45,65)], lambda x: x/255)
helper_test_op([(45,65)], lambda x: x/1)
Expand Down

0 comments on commit 1ded938

Please sign in to comment.