当前位置:网站首页>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/…
边栏推荐
猜你喜欢
随机推荐
Douyin API interface
1106 2019 Sequence (15 points)
1101 How many times B is A (15 points)
easyrecovery15数据恢复软件收费吗?功能强大吗?
My creative anniversary丨Thank you for being with you for these 365 days, not forgetting the original intention, and each is wonderful
测试用例很难?有手就行
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
SQL sliding window
2022-08-09 Group 4 Self-cultivation class study notes (every day)
Waldom Electronics宣布成立顾问委员会
js根据当天获取前几天的日期
项目2-年收入判断
3.2-分类-Logistic回归
How do you optimize the performance of your Unity project?
4.1-支持向量机
2021-08-11 for循环结合多线程异步查询并收集结果
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
1003 I want to pass (20 points)
1046 划拳 (15 分)
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比