Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
NKNaN committed Apr 25, 2024
1 parent 918be06 commit d120fb8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/paddle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@
'standard_gamma',
'sinh',
'sinh_',
'round',
'sinc',
'sinc_' 'round',
'DataParallel',
'argmin',
'prod',
Expand Down
21 changes: 21 additions & 0 deletions test/legacy_test/test_sinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit d120fb8

Please sign in to comment.