From 7d87a36f80a68e32db9c79000fbc68449556bbe3 Mon Sep 17 00:00:00 2001 From: liuyuang Date: Fri, 25 Nov 2022 11:03:15 +0800 Subject: [PATCH] add value compare --- backends/mlu/tests/unittests/test_zero_dim_tensor_mlu.py | 1 + backends/npu/tests/unittests/test_zero_dim_tensor_npu.py | 1 + 2 files changed, 2 insertions(+) diff --git a/backends/mlu/tests/unittests/test_zero_dim_tensor_mlu.py b/backends/mlu/tests/unittests/test_zero_dim_tensor_mlu.py index 3805fc97f..476546ad2 100644 --- a/backends/mlu/tests/unittests/test_zero_dim_tensor_mlu.py +++ b/backends/mlu/tests/unittests/test_zero_dim_tensor_mlu.py @@ -434,6 +434,7 @@ def test_searchsorted(self): out = paddle.searchsorted(x, y) self.assertEqual(out.shape, []) + self.assertEqual(out.numpy(), 0) # Use to test API whose zero-dim input tensors don't have grad and not need to test backward in OpTest. diff --git a/backends/npu/tests/unittests/test_zero_dim_tensor_npu.py b/backends/npu/tests/unittests/test_zero_dim_tensor_npu.py index 08236377d..b5a26f501 100644 --- a/backends/npu/tests/unittests/test_zero_dim_tensor_npu.py +++ b/backends/npu/tests/unittests/test_zero_dim_tensor_npu.py @@ -434,6 +434,7 @@ def test_searchsorted(self): out = paddle.searchsorted(x, y) self.assertEqual(out.shape, []) + self.assertEqual(out.numpy(), 0) # Use to test API whose zero-dim input tensors don't have grad and not need to test backward in OpTest. class TestNoBackwardAPI(unittest.TestCase):