【发布时间】:2018-04-19 20:10:37
【问题描述】:
我正在学习 tensorflow,我从 tensorflow 网站上获取了以下代码。根据我的理解,axis=0 代表行,axis=1 代表列。
他们如何获得 cmets 中提到的输出?我已经根据我对##的想法提到了输出。
import tensorflow as tf
x = tf.constant([[1, 1, 1], [1, 1, 1]])
tf.reduce_sum(x, 0) # [2, 2, 2] ## [3, 3]
tf.reduce_sum(x, 1) # [3, 3] ##[2, 2, 2]
tf.reduce_sum(x, [0, 1]) # 6 ## Didn't understand at all.
【问题讨论】:
标签: python tensorflow multidimensional-array reduce tensor