tf.reduce_mean(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)###
Computes the mean of elements across dimensions of a tensor.
可跨越维度的计算张量各元素的平均值
Reduces input_tensor along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.
根据给出的axis在input_tensor上求平均值。除非keep_dims为真,axis中的每个的张量秩会减少1。如果keep_dims为真,求平均值的维度的长度都会保持为1.
If axis has no entries, all dimensions are reduced, and a tensor with a single element is returned.
如果不设置axis,所有维度上的元素都会被求平均值,并且只会返回一个只有一个元素的张量。
For example:
# 'x' is [[1., 1.]
# [2., 2.]]
tf.reduce_mean(x) ==> 1.5tf.reduce_mean(x, 0) ==> [1.5, 1.5]tf.reduce_mean(x, 1) ==> [1., 2.]
例如:
# 'x' is [[1., 1.]
# [2., 2.]]
tf.reduce_mean(x) ==> 1.5tf.reduce_mean(x, 0) ==> [1.5, 1.5]tf.reduce_mean(x, 1) ==> [1., 2.]
Args:
input_tensor: The tensor to reduce. Should have numeric type.
axis: The dimensions to reduce. If None (the default), reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
reduction_indices: The old (deprecated) name for axis.
参数:
input_tensor: 需要求平均值的张量。应该存在数字类型。
axis: 需要求平均值的维度. 如果没有设置(默认情况),所有的维度都会被减值。
keep_dims: 如果为真,维持减少的维度长度为1..
name: 操作的名字(可选值).
reduction_indices: 旧的axis参数的名字(已弃用).
Returns:
The reduced tensor.
一个求出平均值的张量。
@compatibility(numpy) Equivalent to np.mean @end_compatibility
@compatibility(numpy) 等价于 np.mean @end_compatibility