From c470857e359078db3a717d79d55c30859325ae2c Mon Sep 17 00:00:00 2001 From: dingpeifei Date: Tue, 20 Jul 2021 00:48:53 +0800 Subject: [PATCH] clean_0720_master --- mindspore/_checkparam.py | 1 + mindspore/context.py | 3 ++- mindspore/log.py | 1 + mindspore/run_check/run_check.py | 5 ++++- mindspore/train/_utils.py | 4 ++++ mindspore/train/callback/_callback.py | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mindspore/_checkparam.py b/mindspore/_checkparam.py index 5bfa93783a0..978256756a1 100644 --- a/mindspore/_checkparam.py +++ b/mindspore/_checkparam.py @@ -28,6 +28,7 @@ from mindspore.common import dtype as mstype from mindspore._c_expression import Tensor as Tensor_ class Rel(Enum): + """Numerical relationship between variables, logical relationship enumeration definition of range.""" # scalar compare EQ = 1 # == diff --git a/mindspore/context.py b/mindspore/context.py index 24b3ee5b475..fae2c68a320 100644 --- a/mindspore/context.py +++ b/mindspore/context.py @@ -643,7 +643,8 @@ def set_context(**kwargs): a file by default, and turns off printing to the screen. If the file already exists, add a timestamp suffix to the file. Default: ''. enable_sparse (bool): Whether to enable sparsity feature. Default: False. - For details of sparsity and sparse tensor, please check ``_. + For details of sparsity and sparse tensor, please check + ``_. max_call_depth (int): Specify the maximum depth of function call. Must be positive integer. Default: 1000. env_config_path (str): Config path for DFX. auto_tune_mode (str): The mode of auto tune when op building, get the best tiling performance, diff --git a/mindspore/log.py b/mindspore/log.py index c69a07b23bb..4bcbbc2c7f5 100644 --- a/mindspore/log.py +++ b/mindspore/log.py @@ -290,6 +290,7 @@ def _get_env_config(): return config_dict def _verify_config(kwargs): + """ Verify log configurations. diff --git a/mindspore/run_check/run_check.py b/mindspore/run_check/run_check.py index d7904ffa844..0467e10b08b 100644 --- a/mindspore/run_check/run_check.py +++ b/mindspore/run_check/run_check.py @@ -27,7 +27,8 @@ try: ms = import_module("mindspore") except ModuleNotFoundError: ms = None - +finally: + pass def _check_mul(): """ @@ -65,3 +66,5 @@ def run_check(): except Exception as e: print("MindSpore running check failed.") print(str(e)) + finally: + pass diff --git a/mindspore/train/_utils.py b/mindspore/train/_utils.py index f4d5e343b6b..413e27366aa 100644 --- a/mindspore/train/_utils.py +++ b/mindspore/train/_utils.py @@ -97,6 +97,8 @@ def _make_directory(path: str): except PermissionError as e: logger.error("No write permission on the directory(%r), error = %r", path, e) raise TypeError("No write permission on the directory.") + finally: + pass return real_path @@ -238,6 +240,8 @@ def read_proto(file_name, proto_format="MINDIR", display_data=False): except BaseException as e: logger.error("Failed to read the file `%s`, please check the correct of the file.", file_name) raise ValueError(e.__str__()) + finally: + pass if proto_format == "MINDIR" and not display_data: for param_proto in model.graph.parameter: diff --git a/mindspore/train/callback/_callback.py b/mindspore/train/callback/_callback.py index 0b30feeae7c..079b7ad0165 100644 --- a/mindspore/train/callback/_callback.py +++ b/mindspore/train/callback/_callback.py @@ -23,6 +23,7 @@ from mindspore.train.summary.summary_record import _cache_summary_tensor_data _cur_net = None def set_cur_net(net): + """ Set current net for which we are using to save checkpoint.