!40650 Clean Code Modification

Merge pull request !40650 from shaojunsong/clean_code820
This commit is contained in:
i-robot 2022-08-24 01:52:38 +00:00 committed by Gitee
commit 0b3d48a058
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -3418,10 +3418,10 @@ class Tensor(Tensor_):
try:
data = np.ndarray(shape, dtype=mstype.dtype_to_nptype(self.dtype))
except ValueError:
except ValueError as e:
msg = "Error shape={}".format(shape)
logger.critical(msg)
raise ValueError(msg)
raise ValueError(msg) from e
class seed_context:
"""Set and restore seed."""