MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / reduce_any

Function reduce_any

tensorflow/python/ops/math_ops.py:2365–2405  ·  view source on GitHub ↗

Computes the "logical or" of elements across dimensions of a tensor. Reduces `input_tensor` along the dimensions given in `axis`. Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each entry in `axis`. If `keepdims` is true, the reduced dimensions are retained with lengt

(input_tensor, axis=None, keepdims=False, name=None)

Source from the content-addressed store, hash-verified

2363@tf_export("math.reduce_any", "reduce_any", v1=[])
2364@dispatch.add_dispatch_support
2365def reduce_any(input_tensor, axis=None, keepdims=False, name=None):
2366 """Computes the "logical or" of elements across dimensions of a tensor.
2367
2368 Reduces `input_tensor` along the dimensions given in `axis`.
2369 Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
2370 entry in `axis`. If `keepdims` is true, the reduced dimensions
2371 are retained with length 1.
2372
2373 If `axis` is None, all dimensions are reduced, and a
2374 tensor with a single element is returned.
2375
2376 For example:
2377
2378 ```python
2379 x = tf.constant([[True, True], [False, False]])
2380 tf.reduce_any(x) # True
2381 tf.reduce_any(x, 0) # [True, True]
2382 tf.reduce_any(x, 1) # [True, False]
2383 ```
2384
2385 Args:
2386 input_tensor: The boolean tensor to reduce.
2387 axis: The dimensions to reduce. If `None` (the default), reduces all
2388 dimensions. Must be in the range `[-rank(input_tensor),
2389 rank(input_tensor))`.
2390 keepdims: If true, retains reduced dimensions with length 1.
2391 name: A name for the operation (optional).
2392
2393 Returns:
2394 The reduced tensor.
2395
2396 @compatibility(numpy)
2397 Equivalent to np.any
2398 @end_compatibility
2399 """
2400 keepdims = False if keepdims is None else keepdims
2401 return _may_reduce_to_scalar(
2402 keepdims, axis,
2403 gen_math_ops._any(
2404 input_tensor, _ReductionDims(input_tensor, axis), keepdims,
2405 name=name))
2406
2407
2408@tf_export(v1=["math.reduce_logsumexp", "reduce_logsumexp"])

Callers 1

reduce_any_v1Function · 0.70

Calls 2

_may_reduce_to_scalarFunction · 0.85
_ReductionDimsFunction · 0.85

Tested by

no test coverage detected