Tensorflow 中以下内容的等价物是什么?
np.sum(A, axis=1)
最佳答案
tf.reduce_sum 是一个更强大的工具。
# 'x' is [[1, 1, 1]
# [1, 1, 1]]
tf.reduce_sum(x) ==> 6
tf.reduce_sum(x, 0) ==> [2, 2, 2]
tf.reduce_sum(x, 1) ==> [3, 3]
tf.reduce_sum(x, 1, keep_dims=True) ==> [[3], [3]]
tf.reduce_sum(x, [0, 1]) ==> 6
关于python - 如何在 Tensorflow 中进行列求和?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35689671/