一个人可以同时接纳两|

jinganglang567

园龄:4年5个月粉丝:0关注:20

2023-04-03 16:41阅读: 34评论: 0推荐: 0

attention

attention机制

attention的核心逻辑类似人类观察图片的逻辑,当人类观察一张陌生的图片时,并没有完全看清整个图片,而是把注意力集中到了图片焦点上。所以attention的逻辑就是从关注全部到关注重点。

人类的视觉系统就是一种attention机制,将有限的注意力集中在重点信息上,从而节省资源,快速获得最有效的信息。

attention机制是NLP和BERT的核心。

长距离的信息会被弱化,类似记忆能力弱的人,记不住过去的事情。attention是挑重点,就算文本比较长,也能从中间抓住重点,不丢失重要信息。

attention原理可以看作3个步骤,将query和key值进行相似度计算,得到权值,计算方法可以使用点乘算法,矩阵相乘和cos相似度等算法。计算出权值后将权值归一化,得到可以直接用的权重,将权重和value加权求和。

attention的计算区域有很多种,根据计算区域的key值划分。

soft attention是比较常见的attention方式,对所有key求权重概率,每个key都有一个对应的的权重,是一种全局的计算方式。

hard attention这种方式是直接精准定位到某个key,相当于这个key的概率是1,其余的概率是0。

local attention是两种方式的折中,对一个领域进行计算时,先使用hard attention的方法定位到某个点,然后以这个点为中心得到一个窗口领域,在窗口区域中再使用soft attention计算。

本文作者:jinganglang567

本文链接:https://www.cnblogs.com/tgfoven/p/17283549.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   jinganglang567  阅读(34)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!
  1. 1 look after you louis tomlinson
  2. 2 just hold on louis tomlinson
  3. 3 i can steven cooper
  4. 4 rock me one direction
  5. 5 just can't let her go one direction
  6. 6 this town Niall Horan
  7. 7 cut in love july
  8. 8 nemo 夜愿
  9. 9 in the end Black Veil Brides
  10. 10 glad you came the wanted
  11. 11 chasing the sun the wanted
  12. 12 TAKE MY HAND simple plan
  13. 13 wish i had an angel 夜愿
TAKE MY HAND - simple plan
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

作词 : Comeau, Charles-Andre / Bouvier, Pierre

作曲 : Comeau, Charles-Andre / Bouvier, Pierre

Hey,hey

Hey,hey

Sometimes I feel like everybody's got a problem

Sometimes I feel like nobody wants to solve them

I know that people say we're never gonna make it

But I know we're going to get through this

Close your eyes and please don't let me go

Don't don't don't don't let me go now

Close your eyes don't let me let you go

Don't don't don't

Take my hand tonight

Let's not think about tomorrow

Take my hand tonight

We could find some place to go

'Cause our hearts are locked forever

And our love will never die

Take my hand tonight

One last time

Hey,hey

Hey,hey

The city sleeps and we're lost in the moment

Another kiss says we're lying on the pavement

If they could see us they would tell us that we're crazy

But I know they just don't understand

Close your eyes and please don't let me go

Don't don't don't don't let me go now

Close your eyes don't let me let you go

Don't don't don't

Take my hand tonight

Let's not think about tomorrow

Take my hand tonight

We could find some place to go

Cause our hearts are locked forever

And our love will never die

Take my hand tonight

One last time

Hey,hey

Hey,hey

The raindrops

The tears keep falling

I see your face and it keeps me going

If I get lost your light's gonna guide me

And I know that you can take me home

You can take me home

Take my hand tonight

Let's not think about tomorrow

Take my hand tonight

We could find some place to go

'Cause our hearts are locked forever

And our love will never die

Take my hand tonight

One last time

Take my hand tonight

Let's not think about tomorrow

Take my hand tonight

We could find some place to go

'Cause our hearts are locked forever

And our love will never die

Take my hand tonight

One last time

点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起