当前位置:网站首页>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,那麼就有三組數據分別要進行歸一化

边栏推荐
- & and - > priority
- 如何解决跨域
- 技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
- IPhone address book import into Excel
- CSDN blog operation team 2022 H1 summary
- Musk has more than 100 million twitter fans, but he has been lost online for a week
- Robotframework learning notes: environment installation and robotframework browser plug-in installation
- GD32 RT-Thread RTC驱动函数
- Compétences Comb 27 @ Body sense Manipulator
- Skill sorting [email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled
猜你喜欢

The latest SCI impact factor release: the highest score of domestic journals is 46! Netizen: I understand if

Anhui "requirements for design depth of Hefei fabricated building construction drawing review" was printed and distributed; Hebei Hengshui city adjusts the pre-sale license standard for prefabricated

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

移植完整版RT-Thread到GD32F4XX(详细)
![[deep learning] common methods for deep learning to detect small targets](/img/c6/8f0549864992a1554397bad16dad4d.jpg)
[deep learning] common methods for deep learning to detect small targets

GeoffreyHinton:我的五十年深度学习生涯与研究心法

Migrate full RT thread to gd32f4xx (detailed)

The programmer was beaten.

CVPR 2022 | 清华&字节&京东提出BrT:用于视觉和点云3D目标检测的桥接Transformer

同事的接口文档我每次看着就头大,毛病多多。。。
随机推荐
Apple's 5g chip was revealed to have failed in research and development, and the QQ password bug caused heated discussion. Wei Lai responded to the short selling rumors. Today, more big news is here
Kernel linked list (general linked list) "list.h" simple version and individual comments
同事的接口文档我每次看着就头大,毛病多多。。。
GeoffreyHinton:我的五十年深度学习生涯与研究心法
Questions about cookies and sessions
技能梳理[email protected]基于51系列单片机的智能仪器教具
R language plot visualization: use plot to visualize the prediction confidence of the multi classification model, the prediction confidence of each data point of the model in the 2D grid, and the conf
matplotlib 笔记: contourf & contour
Android 开发面试真题进阶版(附答案解析)
Typescript – classes in Es5, inheritance, static methods
Gd32 RT thread flash driver function
Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
ArcGIS Pro scripting tool (5) - delete duplicates after sorting
Jinbei LT6 is powerful in the year of the tiger, making waves
mysql数据库基础:存储过程和函数
Yixian e-commerce released its first quarterly report: adhere to R & D and brand investment to achieve sustainable and high-quality development
05_Node js 文件管理模块 fs
Agile Development: super easy to use bucket estimation system
Curl --- the request fails when the post request parameter is too long (more than 1024b)
Turn to cartoon learning notes