diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 09eb9c9c30d29..d34f76b1c7633 100644 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -805,7 +805,8 @@ 'standard_gamma', 'sinh', 'sinh_', - 'round', + 'sinc', + 'sinc_' 'round', 'DataParallel', 'argmin', 'prod', diff --git a/test/legacy_test/test_sinc.py b/test/legacy_test/test_sinc.py index a3ed1e30b782e..0750facf55cff 100644 --- a/test/legacy_test/test_sinc.py +++ b/test/legacy_test/test_sinc.py @@ -144,6 +144,22 @@ def test_input_dype_error(self): res = paddle.sinc(x) static_result = exe.run(feed={'x': x_data}, fetch_list=[res])[0] + +class TestSincInplaceAPI(unittest.TestCase): + def setUp(self): + self.cpu_support_dtypes = [ + 'float32', + 'float64', + ] + self.cuda_support_dtypes = [ + 'float32', + 'float64', + ] + self.place = [paddle.CPUPlace()] + if core.is_compiled_with_cuda(): + self.place.append(paddle.CUDAPlace(0)) + self.shapes = [[6], [16, 64]] + def test_inplace(self): def run_dygraph(place): paddle.disable_static(place) @@ -165,6 +181,11 @@ def run_dygraph(place): for place in self.place: run_dygraph(place) + def test_inplace_input_type_error(self): + with self.assertRaises(TypeError): + x = np.random.rand(6).astype('float32') + paddle.sinc_(x) + @unittest.skipIf( not core.is_compiled_with_cuda()