forked from mindspore-Ecosystem/mindspore
!12386 issue #I37W2N & #I37W2L
From: @jachua Reviewed-by: @liangchenghui,@liangchenghui Signed-off-by: @liangchenghui
This commit is contained in:
commit
4b805b87ee
|
@ -347,15 +347,8 @@ def isfinite(x, out=None, where=True, dtype=None):
|
|||
|
||||
|
||||
def _isnan(x):
|
||||
"""Compures isnan without applying keyword arguments."""
|
||||
shape = F.shape(x)
|
||||
zeros_tensor = zeros(shape, mstype.float32)
|
||||
ones_tensor = ones(shape, mstype.float32)
|
||||
non_neg = F.tensor_ge(x, zeros_tensor)
|
||||
non_pos = F.tensor_le(x, zeros_tensor)
|
||||
res = F.select(non_neg, zeros_tensor, ones_tensor)
|
||||
res = F.select(non_pos, zeros_tensor, res)
|
||||
return F.cast(res, mstype.bool_)
|
||||
"""Computes isnan without applying keyword arguments."""
|
||||
return F.not_equal(x, x)
|
||||
|
||||
|
||||
def isnan(x, out=None, where=True, dtype=None):
|
||||
|
@ -392,7 +385,7 @@ def isnan(x, out=None, where=True, dtype=None):
|
|||
TypeError: if the input is not a tensor.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> output = np.isnan(np.array(np.nan, np.float32))
|
||||
|
@ -453,7 +446,7 @@ def isinf(x, out=None, where=True, dtype=None):
|
|||
TypeError: if the input is not a tensor.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> output = np.isinf(np.array(np.inf, np.float32))
|
||||
|
@ -497,7 +490,7 @@ def isposinf(x):
|
|||
TypeError: if the input is not a tensor.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> output = np.isposinf(np.array([-np.inf, 0., np.inf], np.float32))
|
||||
|
@ -527,7 +520,7 @@ def isneginf(x):
|
|||
TypeError: if the input is not a tensor.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> output = np.isneginf(np.array([-np.inf, 0., np.inf], np.float32))
|
||||
|
|
|
@ -748,14 +748,6 @@ def test_diag_indices():
|
|||
onp_res = onp.diag_indices(0)
|
||||
match_all_arrays(mnp_res, onp_res)
|
||||
|
||||
mnp_res = mnp.diag_indices(3, 0)
|
||||
onp_res = onp.diag_indices(3, 0)
|
||||
match_all_arrays(mnp_res, onp_res)
|
||||
|
||||
mnp_res = mnp.diag_indices(5, 7)
|
||||
onp_res = onp.diag_indices(5, 7)
|
||||
match_all_arrays(mnp_res, onp_res)
|
||||
|
||||
|
||||
def mnp_ix_(*args):
|
||||
return mnp.ix_(*args)
|
||||
|
|
|
@ -191,8 +191,6 @@ def onp_isnan(x):
|
|||
|
||||
|
||||
@pytest.mark.level1
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.platform_x86_gpu_training
|
||||
@pytest.mark.platform_x86_cpu
|
||||
@pytest.mark.env_onecard
|
||||
|
@ -209,8 +207,6 @@ def onp_isinf(x):
|
|||
|
||||
|
||||
@pytest.mark.level1
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.platform_x86_gpu_training
|
||||
@pytest.mark.platform_x86_cpu
|
||||
@pytest.mark.env_onecard
|
||||
|
@ -227,8 +223,6 @@ def onp_isposinf(x):
|
|||
|
||||
|
||||
@pytest.mark.level1
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.platform_x86_gpu_training
|
||||
@pytest.mark.platform_x86_cpu
|
||||
@pytest.mark.env_onecard
|
||||
|
@ -245,8 +239,6 @@ def onp_isneginf(x):
|
|||
|
||||
|
||||
@pytest.mark.level1
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.platform_x86_gpu_training
|
||||
@pytest.mark.platform_x86_cpu
|
||||
@pytest.mark.env_onecard
|
||||
|
|
|
@ -1002,8 +1002,6 @@ def onp_fmod(x, y):
|
|||
|
||||
|
||||
@pytest.mark.level1
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.platform_x86_gpu_training
|
||||
@pytest.mark.platform_x86_cpu
|
||||
@pytest.mark.env_onecard
|
||||
|
|
Loading…
Reference in New Issue