当前位置:网站首页>pytorch 笔记 torch.nn.BatchNorm1d
pytorch 笔记 torch.nn.BatchNorm1d
2022-06-30 10:03:00 【UQI-LIUWJ】
1 主要参数介绍
torch.nn.BatchNorm1d(num_features, eps=1e-05)
num_features | 需要进行归一化的数据维度,一般等于dim_hid |
eps | 加到分母上的值,以保证数值稳定性 |
2 num_feature分析
batch normalization是对一个batch里面的每一个维度分别进行归一化
举一个例子:
a=torch.Tensor([[1,1,1],
[2,-3,5],
[0.1,-0.3,0.5],
[1.2,-1.3,1.5]])
f1=torch.nn.BatchNorm1d(3)
f2=torch.nn.BatchNorm1d(4)
print(a,'\n',f1(a),'\n',f2(a.T))
'''
tensor([[ 1.0000, 1.0000, 1.0000],
[ 2.0000, -3.0000, 5.0000],
[ 0.1000, -0.3000, 0.5000],
[ 1.2000, -1.3000, 1.5000]])
tensor([[-0.1110, 1.3003, -0.5657],
[ 1.3685, -1.4372, 1.6971],
[-1.4425, 0.4106, -0.8485],
[ 0.1849, -0.2738, -0.2828]], grad_fn=<NativeBatchNormBackward0>)
tensor([[ 0.0000e+00, 2.0203e-01, 2.2812e-08, 5.8423e-01],
[ 0.0000e+00, -1.3132e+00, -1.2247e+00, -1.4075e+00],
[ 0.0000e+00, 1.1112e+00, 1.2247e+00, 8.2323e-01]],
grad_fn=<NativeBatchNormBackward0>)
'''
num_features是3,表示每个sample有三个feature,那么就有三组数据分别要进行归一化
边栏推荐
- Skill combing [email protected] somatosensory manipulator
- CVPR 2022 | Tsinghua & bytek & JD put forward BRT: Bridging Transformer for vision and point cloud 3D target detection
- 半钢同轴射频线的史密斯圆图查看和网络分析仪E5071C的射频线匹配校准
- 苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
- Auto Seg-Loss: 自动损失函数设计
- 我的远程办公深度体验 | 社区征文
- Smith chart view of semi steel coaxial RF line and RF line matching calibration of network analyzer e5071c
- "Hackers and painters" -- why not be stupid
- My in-depth remote office experience | community essay solicitation
- Dow Jones Industrial Average
猜你喜欢
那个程序员,被打了。
MySQL index, transaction and storage engine of database (3)
Criu enables hot migration
The performance of arm's new CPU has been improved by 22%, up to 12 cores can be combined, and the GPU is first equipped with hardware optical tracking. Netizen: the gap with apple is growing
MATLAB image histogram equalization, namely spatial filtering
ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
Kernel linked list (general linked list) "list.h" simple version and individual comments
ArcGIS Pro scripting tool (5) - delete duplicates after sorting
[email protected]體感機械臂"/>
技能梳理[email protected]體感機械臂
Use keil5 software to simulate and debug gd32f305 from 0
随机推荐
Circuit breaker hystrixcircuitbreaker
Compétences Comb 27 @ Body sense Manipulator
如何解决跨域
Voir le changement technologique à travers la Légion Huawei (5): Smart Park
R语言aov函数进行重复测量方差分析(Repeated measures ANOVA、其中一个组内因素和一个组间因素)、分别使用interaction.plot函数和boxplot对交互作用进行可视化
文件共享服务器
Oracle creates a stored procedure successfully, but the compilation fails
Eth is not connected to the ore pool
Who should the newly admitted miners bow to in front of the chip machine and the graphics card machine
程序员需知的 59 个网站
历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
那个程序员,被打了。
半钢同轴射频线的史密斯圆图查看和网络分析仪E5071C的射频线匹配校准
Remember the experience of an internship. It is necessary to go to the pit (I)
Leetcode question brushing (I) -- double pointer (go Implementation)
Gd32 RT thread PWM drive function
CSDN daily one practice 2021.11.06 question 1 (C language)
【深度学习】深度学习检测小目标常用方法
Why can't you rob scientists of NFT
SGD has many improved forms. Why do most papers still use SGD?