当前位置:网站首页>pytorch 筆記 torch.nn.BatchNorm1d
pytorch 筆記 torch.nn.BatchNorm1d
2022-06-30 10:43: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,那麼就有三組數據分別要進行歸一化

边栏推荐
- MySQL从入门到精通50讲(三十二)-ScyllaDB生产环境集群搭建
- 内存逃逸分析
- IPhone address book import into Excel
- Ant s19xp appeared in 140t, why is it called the computing power ceiling by the world
- Questions about cookies and sessions
- 同事的接口文档我每次看着就头大,毛病多多。。。
- 智能DNA分子纳米机器人模型来了
- Leetcode question brushing (III) -- binary search (go Implementation)
- [rust daily] the first rust monthly magazine on January 22, 2021 invites everyone to participate
- 运动App如何实现端侧后台保活,让运动记录更完整?
猜你喜欢

苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...

智能DNA分子纳米机器人模型来了
[email protected]+adxl345+ Motor vibration + serial port output"/>Skill sorting [email protected]+adxl345+ Motor vibration + serial port output

ArcGIS Pro + PS 矢量化用地规划图

Android 开发面试真题进阶版(附答案解析)

Musk has more than 100 million twitter fans, but he has been lost online for a week
[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled"/>技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled

go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
[email protected] voice module +stm32+nfc"/>Skill combing [email protected] voice module +stm32+nfc

再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
随机推荐
程序员需知的 59 个网站
GeoffreyHinton:我的五十年深度学习生涯与研究心法
Criu enables hot migration
Skill combing [email protected] voice module +stm32+nfc
[rust daily] several new libraries were released on January 23, 2021
文件共享服务器
Dyson design award, changing the world with sustainable design
我在鹅厂淘到了一波“炼丹神器”,开发者快打包
Notes on numerical calculation - iterative solution of linear equations
技能梳理[email protected]體感機械臂
Gd32 RT thread ota/bootloader driver function
腾讯云数据库工程师能力认证重磅推出,各界共话人才培养难题
GD32 RT-Thread flash驱动函数
[deep learning] common methods for deep learning to detect small targets
Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
R语言aov函数进行重复测量方差分析(Repeated measures ANOVA、其中一个组内因素和一个组间因素)、分别使用interaction.plot函数和boxplot对交互作用进行可视化
Leetcode question brushing (I) -- double pointer (go Implementation)
潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
Gd32 RT thread PWM drive function
The AOV function of R language was used for repeated measures ANOVA (one intra group factor and one inter group factor) and interaction Plot function and boxplot to visualize the interaction