Skip to content

Commit c00f3ce

Browse files
committed
fix rsub unit test
1 parent fad4275 commit c00f3ce

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dipu/tests/python/unittests/test_rsub.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ def test_rsub(self):
2323
self._test_rsub(torch.ones(4, 5) * 1.1, torch.ones(4, 5) * 5, alpha=4)
2424

2525
def test_rsub_scalar(self):
26-
self._test_rsub_scalar(torch.ones(4, 5), 10)
27-
self._test_rsub_scalar(torch.ones(4, 5), 10, 2.5)
26+
# from torch:
27+
# For integral input tensors, argument alpha must not be a floating point number
28+
# Boolean alpha only supported for Boolean results
29+
self._test_rsub_scalar(torch.ones(4, 5), 10, alpha=1)
30+
self.assertRaisesRegex(
31+
RuntimeError,
32+
r"For integral input tensors, argument alpha must not be a floating point number\.",
33+
lambda: self._test_rsub_scalar(torch.ones(4, 5), 10, 2.5)
34+
)
2835

2936

3037
if __name__ == "__main__":

0 commit comments

Comments
 (0)