我这里有第三层阵列
t = tf.constant([[[1., 1., 1.], [2., 2., 2.]], [[3., 3., 3.], [4., 4., 4.]]])
tf.reduce_mean(t,0)
我认为第 0 层均值是 1.5 和 3.5。但是,它给了我 2 和 3。有人可以帮助解释这里发生的事情吗?
<tf.Tensor: id=8966, shape=(2, 3), dtype=float32, numpy=
array([[2., 2., 2.],
[3., 3., 3.]], dtype=float32)>
另外,我不明白的是为什么不
t = tf.constant([[[1., 1., 1.], [2., 2., 2.]], [[3., 3., 3.], [4., 4., 4.]]])
tf.reduce_mean(t,2)
给出答案
[[[1.],[2.]],
[[3.],[4.]]]
?它给出了一个答案
<tf.Tensor: id=9014, shape=(2, 2), dtype=float32, numpy=
array([[1., 2.],
[3., 4.]], dtype=float32)>
第2层[]去哪了?
层的哪一部分我没有理解正确?