From c336870af290ec8a2887f55b72577ba20fbc51c0 Mon Sep 17 00:00:00 2001 From: lianliguang Date: Wed, 23 Jun 2021 15:14:48 +0800 Subject: [PATCH] fix bug of reduce ops infer value --- mindspore/ops/operations/math_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindspore/ops/operations/math_ops.py b/mindspore/ops/operations/math_ops.py index fb616709b46..4ea4a24eea9 100644 --- a/mindspore/ops/operations/math_ops.py +++ b/mindspore/ops/operations/math_ops.py @@ -352,7 +352,7 @@ class _Reduce(PrimitiveWithInfer): if np_reduce_func is not None: value = input_x['value'].asnumpy() - if not axis_v: + if not axis_v and axis_v != 0: axis_v = [i for i in range(len(input_x['shape']))] axis_v = tuple(axis_v) value = np_reduce_func(value, axis_v, keepdims=self.keep_dims)