提交 3e56bfbf 编写于 作者: L LiuChiaChi

add random seed for test_export_deploy_model

上级 fc0943c0
...@@ -516,6 +516,7 @@ class TestModelFunction(unittest.TestCase): ...@@ -516,6 +516,7 @@ class TestModelFunction(unittest.TestCase):
def test_export_deploy_model(self): def test_export_deploy_model(self):
self.set_seed() self.set_seed()
np.random.seed(2020)
for dynamic in [True, False]: for dynamic in [True, False]:
paddle.disable_static() if dynamic else None paddle.disable_static() if dynamic else None
prog_translator = ProgramTranslator() prog_translator = ProgramTranslator()
...@@ -589,6 +590,12 @@ class TestRaiseError(unittest.TestCase): ...@@ -589,6 +590,12 @@ class TestRaiseError(unittest.TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
model = Model(net, inputs, labels) model = Model(net, inputs, labels)
def test_static_without_inputs(self):
paddle.enable_static()
net = MyModel()
with self.assertRaises(TypeError):
model = Model(net)
def test_save_infer_model_without_inputs_and_run_in_dygraph(self): def test_save_infer_model_without_inputs_and_run_in_dygraph(self):
paddle.disable_static() paddle.disable_static()
net = MyModel() net = MyModel()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册