@@ -39,7 +39,7 @@ def argmax(data, axis=None, keepdims=False, exclude=False):
3939
4040 exclude : bool
4141 If `exclude` is true, reduction will be performed on the axes that are
42- NOT in axis instead.
42+ NOT in axis instead.
4343
4444 Returns
4545 -------
@@ -69,7 +69,7 @@ def argmin(data, axis=None, keepdims=False, exclude=False):
6969
7070 exclude : bool
7171 If `exclude` is true, reduction will be performed on the axes that are
72- NOT in axis instead.
72+ NOT in axis instead.
7373
7474 Returns
7575 -------
@@ -100,7 +100,7 @@ def sum(data, axis=None, keepdims=False, exclude=False):
100100
101101 exclude : bool
102102 If `exclude` is true, reduction will be performed on the axes that are
103- NOT in axis instead.
103+ NOT in axis instead.
104104
105105 Returns
106106 -------
@@ -111,6 +111,58 @@ def sum(data, axis=None, keepdims=False, exclude=False):
111111 return _make .sum (data , axis , keepdims , exclude )
112112
113113
114+ def all (data , axis = None , keepdims = False , exclude = False ):
115+ """Computes the logical AND of boolean array elements over given axes.
116+
117+ Parameters
118+ ----------
119+ data : relay.Expr
120+ The input boolean tensor
121+
122+ axis : None or int or tuple of int
123+ Axis or axes along which a sum is performed. The default, axis=None,
124+ will sum all of the elements of the input array. If axis is
125+ negative it counts from the last to the first axis.
126+
127+ keepdims : bool
128+ If this is set to True, the axes which are reduced are left in the result as
129+ dimensions with size one. With this option, the result will broadcast
130+ correctly against the input array.
131+
132+ exclude : bool
133+ If `exclude` is true, reduction will be performed on the axes that are
134+ NOT in axis instead.
135+
136+ Returns
137+ -------
138+ result : relay.Expr
139+ The computed result.
140+
141+ Examples
142+ --------
143+ .. code-block:: python
144+
145+ data = relay.Constant(tvm.nd.array([[[ True, True, True],
146+ [ True, True, True],
147+ [False, True, False]],
148+ [[ True, False, False],
149+ [ True, True, False],
150+ [False, True, True]]]))
151+
152+ relay.all(data, axis=1)
153+ # [[False, True, False],
154+ # [False, False, False]]
155+
156+ relay.all(data, axis=0)
157+ # [[ True, False, False],
158+ # [ True, True, False],
159+ # [False, True, False]]
160+
161+ """
162+ axis = [axis ] if axis and isinstance (axis , int ) else axis
163+ return _make .all (data , axis , keepdims , exclude )
164+
165+
114166def max (data , axis = None , keepdims = False , exclude = False ):
115167 """ Computes the max of array elements over given axes.
116168
@@ -131,7 +183,7 @@ def max(data, axis=None, keepdims=False, exclude=False):
131183
132184 exclude : bool
133185 If `exclude` is true, reduction will be performed on the axes that are
134- NOT in axis instead.
186+ NOT in axis instead.
135187
136188 Returns
137189 -------
@@ -163,7 +215,7 @@ def min(data, axis=None, keepdims=False, exclude=False):
163215
164216 exclude : bool
165217 If `exclude` is true, reduction will be performed on the axes that are
166- NOT in axis instead.
218+ NOT in axis instead.
167219
168220 Returns
169221 -------
@@ -194,7 +246,7 @@ def mean(data, axis=None, keepdims=False, exclude=False):
194246
195247 exclude : bool
196248 If `exclude` is true, reduction will be performed on the axes that are
197- NOT in axis instead.
249+ NOT in axis instead.
198250
199251 Returns
200252 -------
@@ -225,7 +277,7 @@ def prod(data, axis=None, keepdims=False, exclude=False):
225277
226278 exclude : bool
227279 If `exclude` is true, reduction will be performed on the axes that are
228- NOT in axis instead.
280+ NOT in axis instead.
229281
230282 Returns
231283 -------
0 commit comments