!3197 fix dump geir fail

Merge pull request !3197 from fary86/fix_dump_geir_fail
This commit is contained in:
mindspore-ci-bot 2020-07-18 19:24:09 +08:00 committed by Gitee
commit fa2d55820b
2 changed files with 5 additions and 7 deletions

View File

@ -515,18 +515,16 @@ class _Executor:
return None
return self._executor.get_func_graph_proto(exec_id, ir_type)
def export(self, net, file_name, file_format='GEIR'):
def export(self, file_name, graph_id):
"""
Export graph.
Args:
net (Cell): MindSpore network
file_name (str): File name of model to export
file_format (str): MindSpore currently support 'GEIR' and 'ONNX' format for exported model
graph_id (str): id of graph to be exported
"""
from .._c_expression import export_graph
phase = 'export' + '.' + self.phase_prefix + '.' + str(net.create_time)
export_graph(file_name, file_format, phase)
export_graph(file_name, 'GEIR', graph_id)
def fetch_info_for_quant_export(self, exec_id):
"""Get graph proto from pipeline."""

View File

@ -455,8 +455,8 @@ def export(net, *inputs, file_name, file_format='GEIR'):
net.init_parameters_data()
if file_format == 'GEIR':
phase_name = 'export.geir'
_executor.compile(net, *inputs, phase=phase_name)
_executor.export(net, file_name, file_format)
graph_id, _ = _executor.compile(net, *inputs, phase=phase_name)
_executor.export(file_name, graph_id)
elif file_format == 'ONNX': # file_format is 'ONNX'
# NOTICE: the pahse name `export_onnx` is used for judging whether is exporting onnx in the compile pipeline,
# do not change it to other values.