tf.reduce_mean命令用于沿指定轴取平均值。但是,如果未指定轴并使用归零索引,则它将打印中间行。为什么会这样呢?减少指数如何影响输出值?如果我打印sum.eval()命令,为什么会显示[[4,5,6]]? 我也仔细阅读了文档,但没有对reduction_indices给出任何解释。请清除我关于此命令的概念。
a = tf.range(0,12)
b = tf.reshape(a,(4,3))
sum = tf.reduce_mean(b,reduction_indices=[0],keep_dims=True)
sess = tf.InteractiveSession()
print (b.eval())
print (b.get_shape())
print (sum.eval())
print (sum.get_shape())
答案 0 :(得分:0)
SELECT C.CustomerID,
C.CompanyName,
OrdersPlaced = COUNT( O.OrderID),
TotalPrice = SUM( D.Quantity * D.UnitPrice)
FROM Customers AS C
INNER JOIN Orders AS O ON C.CustomerID = O.CustomerID
INNER JOIN [Order Details] AS D ON O.OrderID = D.OrderID
WHERE O.OrderID >= 3
GROUP BY
O.OrderID,
C.CustomerID,
C.CompanyName;
的行为类似于reduction_indices
。
根据axis
的文档:
reduction_indices:轴的旧名称(不赞成使用)。
https://www.tensorflow.org/api_docs/python/tf/reduce_mean
4、5和6只是每列的平均值
tf.reduce_mean