forked from mindspore-Ecosystem/mindspore
!3197 fix dump geir fail
Merge pull request !3197 from fary86/fix_dump_geir_fail
This commit is contained in:
commit
fa2d55820b
|
@ -515,18 +515,16 @@ class _Executor:
|
||||||
return None
|
return None
|
||||||
return self._executor.get_func_graph_proto(exec_id, ir_type)
|
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.
|
Export graph.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
net (Cell): MindSpore network
|
|
||||||
file_name (str): File name of model to export
|
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
|
from .._c_expression import export_graph
|
||||||
phase = 'export' + '.' + self.phase_prefix + '.' + str(net.create_time)
|
export_graph(file_name, 'GEIR', graph_id)
|
||||||
export_graph(file_name, file_format, phase)
|
|
||||||
|
|
||||||
def fetch_info_for_quant_export(self, exec_id):
|
def fetch_info_for_quant_export(self, exec_id):
|
||||||
"""Get graph proto from pipeline."""
|
"""Get graph proto from pipeline."""
|
||||||
|
|
|
@ -455,8 +455,8 @@ def export(net, *inputs, file_name, file_format='GEIR'):
|
||||||
net.init_parameters_data()
|
net.init_parameters_data()
|
||||||
if file_format == 'GEIR':
|
if file_format == 'GEIR':
|
||||||
phase_name = 'export.geir'
|
phase_name = 'export.geir'
|
||||||
_executor.compile(net, *inputs, phase=phase_name)
|
graph_id, _ = _executor.compile(net, *inputs, phase=phase_name)
|
||||||
_executor.export(net, file_name, file_format)
|
_executor.export(file_name, graph_id)
|
||||||
elif file_format == 'ONNX': # file_format is 'ONNX'
|
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,
|
# 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.
|
# do not change it to other values.
|
||||||
|
|
Loading…
Reference in New Issue