diff --git a/mindspore/_checkparam.py b/mindspore/_checkparam.py index 78288ad090..ef0fe4d868 100644 --- a/mindspore/_checkparam.py +++ b/mindspore/_checkparam.py @@ -128,7 +128,7 @@ class Validator: @staticmethod def check_number(arg_name, arg_value, value, rel, prim_name): - """Integer value judgment.""" + """Number value judgment.""" rel_fn = Rel.get_fns(rel) if not rel_fn(arg_value, value): rel_str = Rel.get_strs(rel).format(value) diff --git a/mindspore/ops/_grad/grad_math_ops.py b/mindspore/ops/_grad/grad_math_ops.py index 2f39fe8745..c20cacbc34 100755 --- a/mindspore/ops/_grad/grad_math_ops.py +++ b/mindspore/ops/_grad/grad_math_ops.py @@ -727,7 +727,7 @@ def get_bprop_acosh(self): input_grad = G.AcoshGrad() def bprop(x, out, dout): - dx = input_grad(x, dout) + dx = input_grad(out, dout) return (dx,) return bprop diff --git a/mindspore/ops/_grad/grad_nn_ops.py b/mindspore/ops/_grad/grad_nn_ops.py index fc94544176..3964fef5d2 100755 --- a/mindspore/ops/_grad/grad_nn_ops.py +++ b/mindspore/ops/_grad/grad_nn_ops.py @@ -281,7 +281,7 @@ def get_bprop_elu(self): input_grad = G.EluGrad() def bprop(x, out, dout): - dx = input_grad(dout, x) + dx = input_grad(dout, out) return (dx,) return bprop diff --git a/mindspore/ops/operations/nn_ops.py b/mindspore/ops/operations/nn_ops.py index 48762a88bd..d4d15a0ed5 100644 --- a/mindspore/ops/operations/nn_ops.py +++ b/mindspore/ops/operations/nn_ops.py @@ -308,7 +308,8 @@ class Elu(PrimitiveWithInfer): The data type of input tensor should be float. Args: - alpha (float): The coefficient of negative factor whose type is float. Default: 1.0. + alpha (float): The coefficient of negative factor whose type is float, + only support '1.0' currently. Default: 1.0. Inputs: - **input_x** (Tensor) - The input tensor whose data type should be float. @@ -328,6 +329,7 @@ class Elu(PrimitiveWithInfer): def __init__(self, alpha=1.0): """Init Elu""" validator.check_value_type("alpha", alpha, [float], self.name) + validator.check_number("alpha", alpha, 1.0, Rel.EQ, self.name) def infer_shape(self, input_x): return input_x diff --git a/tests/ut/python/ops/test_nn_ops_check.py b/tests/ut/python/ops/test_nn_ops_check.py index c2a751aa0c..4060bb2e15 100755 --- a/tests/ut/python/ops/test_nn_ops_check.py +++ b/tests/ut/python/ops/test_nn_ops_check.py @@ -123,7 +123,7 @@ raise_set = [ 'skip': ['backward']}), # input is Tensor(int32) ('Elu1', { - 'block': (P.Elu(alpha=0.9), {'exception': TypeError, 'error_keywords': ['Elu']}), + 'block': (P.Elu(), {'exception': TypeError, 'error_keywords': ['Elu']}), 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.int32))], 'skip': ['backward']}),