diff --git a/hapi/model.py b/hapi/model.py index 6b800d29df01b8eaa0428475e6427d67f07303cc..71b08cc628aeff1973598bb6ff2a5cd403e60c1a 100644 --- a/hapi/model.py +++ b/hapi/model.py @@ -1180,6 +1180,8 @@ class Model(fluid.dygraph.Layer): export_for_deployment=True, program_only=False): """ + Save inference model must in static mode. + Args: dirname(str): The directory path to save the inference model. model_filename(str|None): The name of file to save the inference program @@ -1201,7 +1203,9 @@ class Model(fluid.dygraph.Layer): Returns: list: The fetch variables' name list """ - # self.prepare(self.) + assert not fluid.in_dygraph_mode( + ), 'Save inference model must in static mode!' + prog = self._adapter._progs.get('test', None) assert prog, \ "Model is not ready, please call `model.prepare()` first"