<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Deep Learning on 龙犊&amp;小窝🪹~</title>
    <link>https://biglonglong.github.io/home/tags/deep-learning/</link>
    <description>Recent content in Deep Learning on 龙犊&amp;小窝🪹~</description>
    <image>
      <title>龙犊&amp;小窝🪹~</title>
      <url>https://biglonglong.github.io/image/thumbnail.png</url>
      <link>https://biglonglong.github.io/image/thumbnail.png</link>
    </image>
    <generator>Hugo -- 0.136.5</generator>
    <language>home</language>
    <copyright>biglonglong🐲</copyright>
    <lastBuildDate>Tue, 05 May 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://biglonglong.github.io/home/tags/deep-learning/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>代码题：Multi-Head Attention 实现</title>
      <link>https://biglonglong.github.io/home/posts/cases/%E7%AE%97%E6%B3%95%E9%A2%98%E5%A4%9A%E5%A4%B4%E6%B3%A8%E6%84%8F%E5%8A%9B%E6%9C%BA%E5%88%B6/</link>
      <pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate>
      <guid>https://biglonglong.github.io/home/posts/cases/%E7%AE%97%E6%B3%95%E9%A2%98%E5%A4%9A%E5%A4%B4%E6%B3%A8%E6%84%8F%E5%8A%9B%E6%9C%BA%E5%88%B6/</guid>
      <description>&lt;h2 id=&#34;问题描述&#34;&gt;问题描述&lt;/h2&gt;
&lt;p&gt;实现一个多头注意力机制，给定输入 &lt;code&gt;query&lt;/code&gt;、&lt;code&gt;key&lt;/code&gt;、&lt;code&gt;value&lt;/code&gt; 和可选的 &lt;code&gt;mask&lt;/code&gt;，计算输出和注意力权重。&lt;/p&gt;
&lt;p&gt;具体需要完成以下几个步骤：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;对 Q、K、V 进行线性变换&lt;/li&gt;
&lt;li&gt;拆分为多头并进行缩放点积注意力计算&lt;/li&gt;
&lt;li&gt;合并多头结果&lt;/li&gt;
&lt;li&gt;通过输出线性层映射回原维度&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;解题思路&#34;&gt;解题思路&lt;/h2&gt;
&lt;p&gt;多头注意力是 Transformer 的核心模块，其核心思想是将输入投影到多个子空间，分别计算注意力，再拼接起来。关键点在于：&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
