当前位置:网站首页>reduce_sum()中的reduction_indices
reduce_sum()中的reduction_indices
2022-06-22 05:44:00 【惊瑟】
参考知乎这篇答案
https://www.zhihu.com/question/51325408/answer/125426642
reduction_indices,直译过来就是指“坍塌维度”,即按照哪个维度进行加法运算。
如:

由于square(y-x)=[1,4,9,16],是个一维向量(张量),所以reduction_indices只能设为0,设其他会报错。运算结果是30,也就是1维坍塌为0维。
将xy换成二维张量试试:

此时,square(y-x)=[[1,4,9,16],[1,4,9,16]],各位猜测一下结果是多少呢?没错,就是按照0维坍塌,即“行”,即原来的n行变1行,即按行进行sum,答案为[2,8,18,32]。
举一反三,如果reduction_indices=[1]呢?
答案是:[30,30],可以理解为[[30],[30]]。
over。
边栏推荐
- 虚职、架空、拖后腿,大厂开源办公室到底什么样?
- GrabCut分析
- Link a static library‘s all sections
- Unity development - scene asynchronous loading
- Test platform for combinational logic blocks
- DOS bat syntax record I
- 朗国科技助力OpenHarmony生态繁荣
- MFC tabctrl control to modify label size
- TiDB 社区线下交流会,天津 & 石家庄的小伙伴看过来~
- 400-哈希表(1. 两数之和、454. 四数相加 II、383. 赎金信)
猜你喜欢

C language pointer (Advanced)

Keil调试时设置断点的高级用法

DataBricks从开源到商业化踩过的坑

Unity app improves device availability

Analysis of annual average temperature based on TMP data in cru

Vscode remote connection error: server status check failed - waiting and retrying

C指針的理解

Adaboost

Frame profiling

Vscode minimalist installation tutorial
随机推荐
I2C interface
为Cortex-M4编写优化的DSP代码
Gerrit Code Review Setup
Single precision, double precision and precision (Reprint)
Frame profiling
爬虫初始及项目
MFC TabCtrl 控件修改標簽尺寸
Adaboost
格雷码与二进制的转换
【技术随记】
I2C接口
AUTOSAR from getting started to mastering 100 lectures (150) -soa architecture and Application
Reptile initial and project
Test platform composed of time sequence
Unity 加密ASE 游戏数据
What about computer jam?
Creating GLSL Shaders at Runtime in Unity3D
Bat 常用批处理脚本记录
Ethernet UDP frame contract design
性能优化 之 3D资产优化及顶点数据管理