forked from mindspore-Ecosystem/mindspore
fix bug of run check
This commit is contained in:
parent
9288aedbaf
commit
9e4f47fa08
|
@ -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']
|
||||
|
|
|
@ -19,10 +19,13 @@ mindspore.run_check
|
|||
The goal is to provide a convenient API to check if the installation is successful or failed.
|
||||
"""
|
||||
|
||||
def _check_mul():
|
||||
"""
|
||||
Define the mul method.
|
||||
"""
|
||||
from importlib import import_module
|
||||
import numpy as np
|
||||
|
||||
|
||||
try:
|
||||
ms = import_module("mindspore")
|
||||
except ModuleNotFoundError:
|
||||
|
@ -30,10 +33,8 @@ except ModuleNotFoundError:
|
|||
finally:
|
||||
pass
|
||||
|
||||
def _check_mul():
|
||||
"""
|
||||
Define the mul method.
|
||||
"""
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue