From 707a42135f259e136423b8d07f1df464399f06c4 Mon Sep 17 00:00:00 2001 From: LiuChiaChi <709153940@qq.com> Date: Sun, 27 Sep 2020 09:21:51 +0000 Subject: [PATCH] set paddle manual seed for unittest --- python/paddle/hapi/model.py | 2 -- python/paddle/tests/test_model.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index ea6d310ad5..936bc77d49 100644 --- a/python/paddle/hapi/model.py +++ b/python/paddle/hapi/model.py @@ -618,7 +618,6 @@ class DynamicGraphAdapter(object): # TODO multi device in dygraph mode not implemented at present time def train_batch(self, inputs, labels=None): - assert self.model._optimizer, \ "model not ready, please call `model.prepare()` first" self.model.network.train() @@ -1858,7 +1857,6 @@ class Model(object): ] self._is_shape_inferred = True self._inputs = self._verify_spec(None, self._shapes, True) - if mode == 'test': return logs, outputs return logs diff --git a/python/paddle/tests/test_model.py b/python/paddle/tests/test_model.py index 6f5163f058..809b25db5e 100644 --- a/python/paddle/tests/test_model.py +++ b/python/paddle/tests/test_model.py @@ -515,6 +515,7 @@ class TestModelFunction(unittest.TestCase): paddle.summary(nlp_net, (1, 1, 2)) def test_export_deploy_model(self): + self.set_seed() for dynamic in [True, False]: paddle.disable_static() if dynamic else None prog_translator = ProgramTranslator() -- GitLab