diff --git a/mindspore/run_check/__init__.py b/mindspore/run_check/__init__.py index e447e82475d..d31d4da6f6d 100644 --- a/mindspore/run_check/__init__.py +++ b/mindspore/run_check/__init__.py @@ -14,7 +14,7 @@ # ============================================================================ """.. run_check package.""" -from .run_check import run_check from ._check_version import check_version_and_env_config +from .run_check import run_check __all__ = ['run_check'] diff --git a/mindspore/run_check/run_check.py b/mindspore/run_check/run_check.py index 0467e10b08b..eaf56dedde8 100644 --- a/mindspore/run_check/run_check.py +++ b/mindspore/run_check/run_check.py @@ -19,21 +19,22 @@ mindspore.run_check The goal is to provide a convenient API to check if the installation is successful or failed. """ -from importlib import import_module -import numpy as np - - -try: - ms = import_module("mindspore") -except ModuleNotFoundError: - ms = None -finally: - pass - def _check_mul(): """ Define the mul method. """ + from importlib import import_module + import numpy as np + + try: + ms = import_module("mindspore") + except ModuleNotFoundError: + ms = None + finally: + pass + + print(f"MindSpore version:", ms.__version__) + input_x = ms.Tensor(np.array([1.0, 2.0, 3.0]), ms.float32) input_y = ms.Tensor(np.array([4.0, 5.0, 6.0]), ms.float32) mul = ms.ops.Mul() @@ -41,14 +42,6 @@ def _check_mul(): print(f"The result of multiplication calculation is correct, MindSpore has been installed successfully!") -def _check_install(): - """ - Define the check install method. - Print MindSpore version. - """ - print(f"MindSpore version:", ms.__version__) - - def run_check(): """ Provide a convenient API to check if the installation is successful or failed. @@ -60,7 +53,6 @@ def run_check(): The result of multiplication calculation is correct, MindSpore has been installed successfully! """ try: - _check_install() _check_mul() # pylint: disable=broad-except except Exception as e: