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

Function mean

tensorflow/python/keras/backend.py:1987–2003  ·  view source on GitHub ↗

Mean of a tensor, alongside the specified axis. Arguments: x: A tensor or variable. axis: A list of integer. Axes to compute the mean. keepdims: A boolean, whether to keep the dimensions or not. If `keepdims` is `False`, the rank of the tensor is reduced by 1

(x, axis=None, keepdims=False)

Source from the content-addressed store, hash-verified

1985
1986@keras_export('keras.backend.mean')
1987def mean(x, axis=None, keepdims=False):
1988 """Mean of a tensor, alongside the specified axis.
1989
1990 Arguments:
1991 x: A tensor or variable.
1992 axis: A list of integer. Axes to compute the mean.
1993 keepdims: A boolean, whether to keep the dimensions or not.
1994 If `keepdims` is `False`, the rank of the tensor is reduced
1995 by 1 for each entry in `axis`. If `keepdims` is `True`,
1996 the reduced dimensions are retained with length 1.
1997
1998 Returns:
1999 A tensor with the mean of elements of `x`.
2000 """
2001 if x.dtype.base_dtype == dtypes_module.bool:
2002 x = math_ops.cast(x, floatx())
2003 return math_ops.reduce_mean(x, axis, keepdims)
2004
2005
2006@keras_export('keras.backend.any')

Callers 3

testSaveRestoreMethod · 0.50
_expected_fnMethod · 0.50
ReduceMeanAcrossImageMethod · 0.50

Calls 3

floatxFunction · 0.85
reduce_meanMethod · 0.80
castMethod · 0.45

Tested by 2

testSaveRestoreMethod · 0.40
_expected_fnMethod · 0.40