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

Function reduce_all

tensorflow/python/ops/math_ops.py:2266–2306  ·  view source on GitHub ↗

Computes the "logical and" 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 leng

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

Source from the content-addressed store, hash-verified

2264@tf_export("reduce_all", "math.reduce_all", v1=[])
2265@dispatch.add_dispatch_support
2266def reduce_all(input_tensor, axis=None, keepdims=False, name=None):
2267 """Computes the "logical and" of elements across dimensions of a tensor.
2268
2269 Reduces `input_tensor` along the dimensions given in `axis`.
2270 Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
2271 entry in `axis`. If `keepdims` is true, the reduced dimensions
2272 are retained with length 1.
2273
2274 If `axis` is None, all dimensions are reduced, and a
2275 tensor with a single element is returned.
2276
2277 For example:
2278
2279 ```python
2280 x = tf.constant([[True, True], [False, False]])
2281 tf.reduce_all(x) # False
2282 tf.reduce_all(x, 0) # [False, False]
2283 tf.reduce_all(x, 1) # [True, False]
2284 ```
2285
2286 Args:
2287 input_tensor: The boolean tensor to reduce.
2288 axis: The dimensions to reduce. If `None` (the default), reduces all
2289 dimensions. Must be in the range `[-rank(input_tensor),
2290 rank(input_tensor))`.
2291 keepdims: If true, retains reduced dimensions with length 1.
2292 name: A name for the operation (optional).
2293
2294 Returns:
2295 The reduced tensor.
2296
2297 @compatibility(numpy)
2298 Equivalent to np.all
2299 @end_compatibility
2300 """
2301 keepdims = False if keepdims is None else keepdims
2302 return _may_reduce_to_scalar(
2303 keepdims, axis,
2304 gen_math_ops._all(
2305 input_tensor, _ReductionDims(input_tensor, axis), keepdims,
2306 name=name))
2307
2308
2309@tf_export(v1=["math.reduce_any", "reduce_any"])

Callers 1

reduce_all_v1Function · 0.70

Calls 2

_may_reduce_to_scalarFunction · 0.85
_ReductionDimsFunction · 0.85

Tested by

no test coverage detected