当前位置:网站首页>常见神经网络参数量与计算量
常见神经网络参数量与计算量
2022-07-23 04:14:00 【qq1033930618】
一、卷积层
注意 使用Batch Normalization时不需要bias 每个输出通道一个数值作为bias
参数量
P = Cout*Cin*K*K+bias
bias = Cout
计算量
步幅为1
乘 加 偏置
FlOPs = [(Cin*k*k)+(Cin*k*k-1)+1]*Cout*W*H
记乘加为浮点运算
FLOPs = Cin*k*k*Cout*W*H
若步幅不为1 可以用输出图片宽高作为WH带入近似
二、全连接
参数量
P = In*Out+bias
bias = Out
计算量
乘 加 偏置
FLOPs = [In+(In-1)+1]*Out
记乘加为浮点运算
FLOPs = In*Out
三、循环神经网络
注意双向要翻倍
参数量
x为输入维度
h为隐层维度
PRNN = (x+h)*h+bias
bias = h
PGRU = 3*PRNN
PLSTM = 4*PRNN
四、注意力
参数量
P = 4*(dim*Innerdim)
Innerdim = headdim*heads
计算量
[B,N,dim]->[B,N,Innerdim]
[B,N,Innerdim]->[B,heads,N,Innerdim/heads]
FLOPs = N*dim*Innerdim*3
Q*K'
FLOPs = heads*N*(Innerdim/heads)*N = N*N*Innerdim
Q*K'*V
FLOPs = heads*N*N*(Innerdim/heads) = N*N*Innerdim
FLOPs = N*dim*Innerdim
总共
FLOPs = 4*N*dim*Innerdim + 2*N*N*Innerdim = 2*N*Innerdim*(2*dim+N)
边栏推荐
- Use and implementation of enumeration classes
- Redis事务-秒杀案例模拟实现详细过程
- 百度沈抖:聚焦场景深耕行业,为企业数字化带来实际成效
- Unity Image中Sprite和overrideSprite区别(转载)
- 比你老师详细系列————结构体
- 添加信任列表
- 网络数据泄露事件频发,个人隐私信息如何保护?
- IDEA 集成 Sonar 完整流程
- chrome selenium 用默认profile 不必每次清空
- Kingbasees SQL language reference manual of Jincang database (8. Function (6))
猜你喜欢

Sonar中如何删除一个项目

网络数据泄露事件频发,个人隐私信息如何保护?

禅道的甘特图功能是什么

阿里云如何将一个域名解析到另一个域名上

Chrome selenium uses the default profile without emptying it every time

After 100 billion of revenue, Alibaba cloud ecosystem has a new way to play

mysql通过sql查询数据库所有表名称及列信息

UnityC#实现中文汉字转拼音-使用微软CHSPinYinConv库

【Delphi】制作控件面板安装图标的简单方法(译)

How does VirtualBox set up port forwarding?
随机推荐
How does VirtualBox set up port forwarding?
MySQL查询优化-详解
PowerBI入门指南
谈谈实施数据治理时常犯的10大错误
[pytorch] the difference between cuda() and to (device)
chrome selenium 用默认profile 不必每次清空
RTC 性能自动化工具在内存优化场景下的实践
振奋人心 元宇宙!下一代互联网的财富风口
配饰器模式
Kingbasees SQL language reference manual of Jincang database (8. Function (8))
More detailed series than your teacher -- structure
SPR:SUPERVISED PERSONALIZED RANKING BASED ON PRIOR KNOWLEDGE FOR RECOMMENDATION
什么是文件管理软件?你为什么需要它?
有关字符串的题目总结
Kingbasees SQL language reference manual of Jincang database (8. Function (6))
1. Assignment statement
Chapter 3 Standard Input
Evidence based design of RF circuits
2022/7/21
数仓:工作流的设计以及优化实践