@@ -166,6 +166,58 @@ def all(data, axis=None, keepdims=False, exclude=False):
166166 return _make .all (data , axis , keepdims , exclude )
167167
168168
169+ def any (data , axis = None , keepdims = False , exclude = False ):
170+ """Computes the logical OR of boolean array elements over given axes.
171+
172+ Parameters
173+ ----------
174+ data : relay.Expr
175+ The input boolean tensor
176+
177+ axis : None or int or tuple of int
178+ Axis or axes along which a sum is performed. The default, axis=None,
179+ will sum all of the elements of the input array. If axis is
180+ negative it counts from the last to the first axis.
181+
182+ keepdims : bool
183+ If this is set to True, the axes which are reduced are left in the result as
184+ dimensions with size one. With this option, the result will broadcast
185+ correctly against the input array.
186+
187+ exclude : bool
188+ If `exclude` is true, reduction will be performed on the axes that are
189+ NOT in axis instead.
190+
191+ Returns
192+ -------
193+ result : relay.Expr
194+ The computed result.
195+
196+ Examples
197+ --------
198+ .. code-block:: python
199+
200+ data = relay.Constant(tvm.nd.array([[[ True, True, True],
201+ [ True, True, True],
202+ [False, True, False]],
203+ [[ True, False, False],
204+ [ True, True, False],
205+ [False, True, True]]]))
206+
207+ relay.any(data, axis=1)
208+ # [[True, True, True],
209+ # [True, True, True]]
210+
211+ relay.any(data, axis=0)
212+ # [[ True, True, True],
213+ # [ True, True, True],
214+ # [False, True, True]]
215+
216+ """
217+ axis = [axis ] if isinstance (axis , int ) else axis
218+ return _make .any (data , axis , keepdims , exclude )
219+
220+
169221def max (data , axis = None , keepdims = False , exclude = False ):
170222 """ Computes the max of array elements over given axes.
171223
0 commit comments