提交 b9463b72 编写于 作者: L LielinJiang

refine save inference model

上级 d2c796bd
...@@ -1180,6 +1180,8 @@ class Model(fluid.dygraph.Layer): ...@@ -1180,6 +1180,8 @@ class Model(fluid.dygraph.Layer):
export_for_deployment=True, export_for_deployment=True,
program_only=False): program_only=False):
""" """
Save inference model must in static mode.
Args: Args:
dirname(str): The directory path to save the inference model. dirname(str): The directory path to save the inference model.
model_filename(str|None): The name of file to save the inference program model_filename(str|None): The name of file to save the inference program
...@@ -1201,7 +1203,9 @@ class Model(fluid.dygraph.Layer): ...@@ -1201,7 +1203,9 @@ class Model(fluid.dygraph.Layer):
Returns: Returns:
list: The fetch variables' name list 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) prog = self._adapter._progs.get('test', None)
assert prog, \ assert prog, \
"Model is not ready, please call `model.prepare()` first" "Model is not ready, please call `model.prepare()` first"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册