Browse Source

!10703 fix the error of removing meta file in pynative mode

From: @caozhou_huawei
Reviewed-by: @changzherui,@zhunaipan,@zh_qh
Signed-off-by: @zh_qh
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
94a24bcddc
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      mindspore/train/callback/_checkpoint.py

+ 1
- 1
mindspore/train/callback/_checkpoint.py View File

@@ -275,7 +275,7 @@ class ModelCheckpoint(Callback):
# save graph (only once)
if not self._graph_saved:
graph_file_name = os.path.join(self._directory, self._prefix + '-graph.meta')
if os.path.isfile(graph_file_name):
if os.path.isfile(graph_file_name) and context.get_context("mode") == context.GRAPH_MODE:
os.remove(graph_file_name)
_save_graph(cb_params.train_network, graph_file_name)
self._graph_saved = True


Loading…
Cancel
Save