x = tf.constant([[0.3776],
[0.3031],
[0.4818],
[0.3887]])
y=tf.reduce_mean(x) # 1.5
tf.reduce_mean(x, 0) # [1.5, 1.5]
tf.reduce_mean(x, 1) # [1., 2.]
with tf.Session() as sess:
print(sess.run(y))
torch.mean和tf.reduce_mean
最新推荐文章于 2024-01-14 10:37:31 发布
本文展示了一个使用TensorFlow进行基础运算的例子,包括定义张量、计算平均值等操作,并通过Session来运行计算过程。
1万+

被折叠的 条评论
为什么被折叠?



