未验证 提交 d72604cd 编写于 作者: B Bai Yifan 提交者: GitHub

fix unittst unstable issue on ci machine (#29588)

* fix unittst unstable issue on ci machine

* fix unittst unstable issue on ci machine

* fix unittst unstable issue on ci machine
上级 0034273b
...@@ -22,11 +22,11 @@ from unittest import TestCase ...@@ -22,11 +22,11 @@ from unittest import TestCase
class TestDeformConv2D(TestCase): class TestDeformConv2D(TestCase):
batch_size = 4 batch_size = 4
spatial_shape = (16, 16) spatial_shape = (5, 5)
dtype = "float32" dtype = "float32"
def setUp(self): def setUp(self):
self.in_channels = 3 self.in_channels = 2
self.out_channels = 5 self.out_channels = 5
self.kernel_size = [3, 3] self.kernel_size = [3, 3]
self.padding = [0, 0] self.padding = [0, 0]
...@@ -36,6 +36,8 @@ class TestDeformConv2D(TestCase): ...@@ -36,6 +36,8 @@ class TestDeformConv2D(TestCase):
self.no_bias = True self.no_bias = True
def prepare(self): def prepare(self):
np.random.seed(1)
paddle.seed(1)
if isinstance(self.kernel_size, int): if isinstance(self.kernel_size, int):
filter_shape = (self.kernel_size, ) * 2 filter_shape = (self.kernel_size, ) * 2
else: else:
...@@ -182,11 +184,11 @@ class TestDeformConv2D(TestCase): ...@@ -182,11 +184,11 @@ class TestDeformConv2D(TestCase):
class TestDeformConv2DFunctional(TestCase): class TestDeformConv2DFunctional(TestCase):
batch_size = 4 batch_size = 4
spatial_shape = (16, 16) spatial_shape = (5, 5)
dtype = "float32" dtype = "float32"
def setUp(self): def setUp(self):
self.in_channels = 3 self.in_channels = 2
self.out_channels = 5 self.out_channels = 5
self.kernel_size = [3, 3] self.kernel_size = [3, 3]
self.padding = [0, 0] self.padding = [0, 0]
...@@ -196,6 +198,8 @@ class TestDeformConv2DFunctional(TestCase): ...@@ -196,6 +198,8 @@ class TestDeformConv2DFunctional(TestCase):
self.no_bias = True self.no_bias = True
def prepare(self): def prepare(self):
np.random.seed(1)
paddle.seed(1)
if isinstance(self.kernel_size, int): if isinstance(self.kernel_size, int):
filter_shape = (self.kernel_size, ) * 2 filter_shape = (self.kernel_size, ) * 2
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册