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

Function reduce_mean_v1

tensorflow/python/ops/math_ops.py:1752–1812  ·  view source on GitHub ↗

Computes the mean 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.

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

Source from the content-addressed store, hash-verified

1750
1751@tf_export(v1=["math.reduce_mean", "reduce_mean"])
1752def reduce_mean_v1(input_tensor,
1753 axis=None,
1754 keepdims=None,
1755 name=None,
1756 reduction_indices=None,
1757 keep_dims=None):
1758 """Computes the mean of elements across dimensions of a tensor.
1759
1760 Reduces `input_tensor` along the dimensions given in `axis`.
1761 Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
1762 entry in `axis`. If `keepdims` is true, the reduced dimensions
1763 are retained with length 1.
1764
1765 If `axis` is None, all dimensions are reduced, and a
1766 tensor with a single element is returned.
1767
1768 For example:
1769
1770 ```python
1771 x = tf.constant([[1., 1.], [2., 2.]])
1772 tf.reduce_mean(x) # 1.5
1773 tf.reduce_mean(x, 0) # [1.5, 1.5]
1774 tf.reduce_mean(x, 1) # [1., 2.]
1775 ```
1776
1777 Args:
1778 input_tensor: The tensor to reduce. Should have numeric type.
1779 axis: The dimensions to reduce. If `None` (the default), reduces all
1780 dimensions. Must be in the range `[-rank(input_tensor),
1781 rank(input_tensor))`.
1782 keepdims: If true, retains reduced dimensions with length 1.
1783 name: A name for the operation (optional).
1784 reduction_indices: The old (deprecated) name for axis.
1785 keep_dims: Deprecated alias for `keepdims`.
1786
1787 Returns:
1788 The reduced tensor.
1789
1790 @compatibility(numpy)
1791 Equivalent to np.mean
1792
1793 Please note that `np.mean` has a `dtype` parameter that could be used to
1794 specify the output type. By default this is `dtype=float64`. On the other
1795 hand, `tf.reduce_mean` has an aggressive type inference from `input_tensor`,
1796 for example:
1797
1798 ```python
1799 x = tf.constant([1, 0, 1, 0])
1800 tf.reduce_mean(x) # 0
1801 y = tf.constant([1., 0., 1., 0.])
1802 tf.reduce_mean(y) # 0.5
1803 ```
1804
1805 @end_compatibility
1806 """
1807 axis = deprecation.deprecated_argument_lookup("axis", axis,
1808 "reduction_indices",
1809 reduction_indices)

Callers

nothing calls this directly

Calls 1

reduce_meanFunction · 0.70

Tested by

no test coverage detected