Skip to content

Commit 92a97cc

Browse files
committed
fix coverage
1 parent 3e91d28 commit 92a97cc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/legacy_test/test_median.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,5 +401,23 @@ def test_median_dygraph(self):
401401
self.dygraph_single_test_median([x, 1, False])
402402

403403

404+
class TestMedianSort(unittest.TestCase):
405+
def dygraph_single_test_median(self, lis_test):
406+
x, axis, keepdims = lis_test
407+
res_np = np.median(x, axis=axis, keepdims=keepdims)
408+
x_pd = paddle.to_tensor(x)
409+
x_pd.stop_gradient = False
410+
res_pd = paddle.median(x_pd, axis, keepdims)
411+
np.testing.assert_allclose(res_pd.numpy(), res_np)
412+
413+
def test_median_dygraph(self):
414+
paddle.disable_static()
415+
h = 2
416+
w = 20000
417+
l = 2
418+
x = np.arange(h * w * l).reshape([h, w, l])
419+
self.dygraph_single_test_median([x, 1, False])
420+
421+
404422
if __name__ == '__main__':
405423
unittest.main()

0 commit comments

Comments
 (0)