tf.reduce_sum()中的参数reduction_indices详解
1
|
distance
=
tf.reduce_sum(tf.
abs
(tf.add(x_train,tf.negative(x_test))),reduction_indices
=
1
)
|
reduce_sum() 就是求和,由于求和的对象是tensor,所以是沿着tensor的某些维度求和。reduction_indices是指沿tensor的哪些维度求和。
具体见下图详细解释: