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

Function reduce_sum_v1

tensorflow/python/ops/math_ops.py:1466–1516  ·  view source on GitHub ↗

Computes the sum 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 length 1. I

(input_tensor,
                  axis=None,
                  keepdims=None,
                  name=None,
                  reduction_indices=None,
                  keep_dims=None)

Source from the content-addressed store, hash-verified

1464 "keep_dims is deprecated, use keepdims instead",
1465 "keep_dims")
1466def reduce_sum_v1(input_tensor,
1467 axis=None,
1468 keepdims=None,
1469 name=None,
1470 reduction_indices=None,
1471 keep_dims=None):
1472 """Computes the sum of elements across dimensions of a tensor.
1473
1474 Reduces `input_tensor` along the dimensions given in `axis`.
1475 Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
1476 entry in `axis`. If `keepdims` is true, the reduced dimensions
1477 are retained with length 1.
1478
1479 If `axis` is None, all dimensions are reduced, and a
1480 tensor with a single element is returned.
1481
1482 For example:
1483
1484 ```python
1485 x = tf.constant([[1, 1, 1], [1, 1, 1]])
1486 tf.reduce_sum(x) # 6
1487 tf.reduce_sum(x, 0) # [2, 2, 2]
1488 tf.reduce_sum(x, 1) # [3, 3]
1489 tf.reduce_sum(x, 1, keepdims=True) # [[3], [3]]
1490 tf.reduce_sum(x, [0, 1]) # 6
1491 ```
1492
1493 Args:
1494 input_tensor: The tensor to reduce. Should have numeric type.
1495 axis: The dimensions to reduce. If `None` (the default), reduces all
1496 dimensions. Must be in the range `[-rank(input_tensor),
1497 rank(input_tensor))`.
1498 keepdims: If true, retains reduced dimensions with length 1.
1499 name: A name for the operation (optional).
1500 reduction_indices: The old (deprecated) name for axis.
1501 keep_dims: Deprecated alias for `keepdims`.
1502
1503 Returns:
1504 The reduced tensor, of the same dtype as the input_tensor.
1505
1506 @compatibility(numpy)
1507 Equivalent to np.sum apart the fact that numpy upcast uint8 and int32 to
1508 int64 while tensorflow returns the same dtype as the input.
1509 @end_compatibility
1510 """
1511 axis = deprecation.deprecated_argument_lookup("axis", axis,
1512 "reduction_indices",
1513 reduction_indices)
1514 keepdims = deprecation.deprecated_argument_lookup("keepdims", keepdims,
1515 "keep_dims", keep_dims)
1516 return reduce_sum(input_tensor, axis, keepdims, name)
1517
1518
1519@tf_export("math.reduce_sum", "reduce_sum", v1=[])

Callers

nothing calls this directly

Calls 1

reduce_sumFunction · 0.70

Tested by

no test coverage detected