fix the error that the memory-related files generated are missing in profiler.

This commit is contained in:
casgj 2021-09-16 09:11:41 +00:00 committed by Gitee
parent f112c42027
commit 7c9b45f373
1 changed files with 3 additions and 4 deletions

View File

@ -17,7 +17,6 @@ from collections import OrderedDict
import json
import os
import stat
from importlib import import_module
from google.protobuf.text_format import ParseError
@ -30,9 +29,9 @@ from mindspore.profiler.parser.container import MemoryNode as Node
from mindspore.profiler.parser.container import MemoryTensor as Tensor
import mindspore._c_expression as c_expression
try:
MemoryProto = import_module("mindspore.train.memory_profiling_pb2.MemoryProto")
except ModuleNotFoundError:
if not c_expression.security.enable_security():
from mindspore.train.memory_profiling_pb2 import MemoryProto
else:
MemoryProto = None
GIGABYTES = 1024 * 1024 * 1024