!40442 clear warning

Merge pull request !40442 from 冯一航/clear_warning
This commit is contained in:
i-robot 2022-08-17 01:51:04 +00:00 committed by Gitee
commit 431cc66e72
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -5850,7 +5850,7 @@ def _check_astype_and_convert(dtype):
dtype = mstype.pytype_to_dtype(np.dtype(dtype.lower()))
elif isinstance(dtype, type):
dtype = mstype.pytype_to_dtype(dtype)
elif not dtype in mstype.number_type + (mstype.bool_,):
elif dtype not in mstype.number_type + (mstype.bool_,):
raise TypeError(
f"For Tensor.astype, the input type must be one of {list(mstype.number_type + (mstype.bool_,) + np_types)},"
f" but got '{dtype}'.")

View File

@ -77,7 +77,7 @@ def _auto_white_list(network, white_list=None):
subcell = cells[name]
if subcell == network:
continue
elif isinstance(subcell, white_list):
if isinstance(subcell, white_list):
network._cells[name] = _OutputTo32(subcell.to_float(mstype.float16))
change = True
else:
@ -97,7 +97,7 @@ def _auto_black_list(network, black_list=None):
subcell = cells[name]
if subcell == network:
continue
elif isinstance(subcell, black_list):
if isinstance(subcell, black_list):
network._cells[name] = _OutputTo16(subcell.to_float(mstype.float32))
change = True
else: