当前位置:网站首页>tf.reduce_mean() and tf.reduce_sum()
tf.reduce_mean() and tf.reduce_sum()
2022-08-11 07:51:00 【phac123】
Introduction
TF.reduce_mean() and tf.reduce_sum() are often used in TF to average and sum the specified dimensions of the specified tensor respectively.
# Calculates the mean of a tensor along the specified dimensiontf.reduce_mean (tensor name, axis=operation axis)# Calculate the sum of the tensor along the specified dimensiontf.reduce_sum (tensor name, axis=operation axis)
Code
import tensorflow as tfx = tf.constant([[1, 2, 3], [2, 2, 3]])print("x: ", x)print("mean of x: ", tf.reduce_mean(x))print("mean of x: ", tf.reduce_mean(x, axis = 0))print("mean of x: ", tf.reduce_mean(x, axis = 1))print("mean of x: ", tf.reduce_sum(x))print("sum of x: ", tf.reduce_sum(x, axis = 0))print("sum of x: ", tf.reduce_sum(x, axis = 1))
Which axis is specified, turn that dimension into 1 row/column/…
边栏推荐
猜你喜欢
随机推荐
计算YUV文件的PSNR与SSIM
1003 I want to pass (20 points)
js判断图片是否存在
梅科尔工作室——BP神经网络
囍楽云任务源码
你是如何做好Unity项目性能优化的
2.1-梯度下降
详述MIMIC 的ICU患者检测时间信息表(十六)
Discourse's Close Topic and Reopen Topic
【Pytorch】nn.PixelShuffle
1096 大美数 (15 分)
easyrecovery15数据恢复软件收费吗?功能强大吗?
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
linux 安装mysql服务报错
Redis源码-String:Redis String命令、Redis String存储原理、Redis字符串三种编码类型、Redis String SDS源码解析、Redis String应用场景
1076 Wifi密码 (15 分)
Production and optimization of Unity game leaderboards
接入网、承载网、核心网是什么,交换机路由器是什么、这个和网络的协议有什么关系呢?
1071 小赌怡情 (15 分)