在tensorflow 1.0版本中,reduction_indices被改为了axis,感觉方便很多。
原答案:
reduce_xxx这类操作,在官方文档中,都放在Reduction下:
ReductionTensorFlow provides several operations that you can use to perform common math computations that reduce various dimensions of a tensor.
也就是说,这些操作的本质就是降维,以xxx的手段降维。
在所有reduce_xxx系列操作中,都有reduction_indices这个参数,即沿某个方向,使用xxx方法,对input_tensor进行降维。
reduction_indices的默认值是None,即把input_tensor降到 0维,也就是一个数。
对于2维input_tensor,reduction_indices=0时,按列;reduction_indices=1时,按行。
求平均值tf.reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None)
参数1--input_tensor:待求值的tensor。
参数2--reduction_indices:在哪一维上求解。
参数(3)(4)可忽略
input_tensor: 被计算的张量,确保为数字类型。
axis: 方向数轴,如果没有指明,默认是所有数轴都减小为1。
keep_dims: 如果定义true, 则保留维数,但数量个数为0.
name: 操作过程的名称。
reduction_indices: 为了旧函数兼容的数轴。
返回值:
降低维数的平均值。