提交 d1ad3367 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!4598 support axis is None for all and any interface in graph mode

Merge pull request !4598 from zhangbuxue/support_axis_is_None_for_all_and_any_in_graph_mode
......@@ -44,6 +44,8 @@ def all_(x, axis=(), keep_dims=False):
Tensor, has the same data type as x.
"""
if axis is None:
axis = ()
reduce_all = P.ReduceAll(keep_dims)
return reduce_all(x, axis)
......@@ -60,7 +62,8 @@ def any_(x, axis=(), keep_dims=False):
Returns:
Tensor, has the same data type as x.
"""
if axis is None:
axis = ()
reduce_any = P.ReduceAny(keep_dims)
return reduce_any(x, axis)
......
......@@ -28,8 +28,8 @@ def test_all_and_any_of_tensor_in_graph():
def construct(self, x):
all_ = x.all()
any_ = x.any()
all_0 = x.all(0, True)
any_0 = x.any(0, True)
all_0 = x.all(None, True)
any_0 = x.any(None, True)
return all_, any_, all_0, any_0
net = Net()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册