diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index ea6d310ad5378511d390868c1c5a36e8ee9291c2..936bc77d491eedbd3a0cb289319d9cda3b647cd2 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 6f5163f0583a958f46df1f275b6db5c22bcaefc8..809b25db5e47f85d681e6b03c98890b40b3625ed 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()