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

Function reduce_std

tensorflow/python/ops/math_ops.py:1922–1964  ·  view source on GitHub ↗

Computes the standard deviation 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

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

Source from the content-addressed store, hash-verified

1920
1921@tf_export("math.reduce_std")
1922def reduce_std(input_tensor, axis=None, keepdims=False, name=None):
1923 """Computes the standard deviation of elements across dimensions of a tensor.
1924
1925 Reduces `input_tensor` along the dimensions given in `axis`.
1926 Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
1927 entry in `axis`. If `keepdims` is true, the reduced dimensions
1928 are retained with length 1.
1929
1930 If `axis` is None, all dimensions are reduced, and a
1931 tensor with a single element is returned.
1932
1933 For example:
1934
1935 ```python
1936 x = tf.constant([[1., 2.], [3., 4.]])
1937 tf.reduce_std(x) # 1.1180339887498949
1938 tf.reduce_std(x, 0) # [1., 1.]
1939 tf.reduce_std(x, 1) # [0.5, 0.5]
1940 ```
1941
1942 Args:
1943 input_tensor: The tensor to reduce. Should have numeric type.
1944 axis: The dimensions to reduce. If `None` (the default), reduces all
1945 dimensions. Must be in the range `[-rank(input_tensor),
1946 rank(input_tensor))`.
1947 keepdims: If true, retains reduced dimensions with length 1.
1948 name: A name scope for the associated operations (optional).
1949
1950 Returns:
1951 The reduced tensor, of the same dtype as the input_tensor.
1952
1953 @compatibility(numpy)
1954 Equivalent to np.std
1955
1956 Please note that `np.std` has a `dtype` parameter that could be used to
1957 specify the output type. By default this is `dtype=float64`. On the other
1958 hand, `tf.reduce_std` has an aggressive type inference from `input_tensor`,
1959 @end_compatibility
1960 """
1961 name = name if name else "reduce_std"
1962 with ops.name_scope(name):
1963 variance = reduce_variance(input_tensor, axis=axis, keepdims=keepdims)
1964 return gen_math_ops.sqrt(variance)
1965
1966
1967@tf_export("math.reduce_prod", "reduce_prod", v1=[])

Callers

nothing calls this directly

Calls 2

reduce_varianceFunction · 0.85
name_scopeMethod · 0.45

Tested by

no test coverage detected