<?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>算子 on Richelieu's Blog</title><link>https://beaiera.top/tags/%E7%AE%97%E5%AD%90/</link><description>Recent content in 算子 on Richelieu's Blog</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Mon, 01 Jun 2026 11:00:00 +0800</lastBuildDate><atom:link href="https://beaiera.top/tags/%E7%AE%97%E5%AD%90/index.xml" rel="self" type="application/rss+xml"/><item><title>mhc_pre_torch 的数学公式与 CUDA 代码解释</title><link>https://beaiera.top/posts/mhc-preact-torch-math/</link><pubDate>Mon, 01 Jun 2026 11:00:00 +0800</pubDate><guid>https://beaiera.top/posts/mhc-preact-torch-math/</guid><description>&lt;h2 id="背景"&gt;背景&lt;/h2&gt;
&lt;p&gt;mHC（multi-Head Combinatorial）是 DeepSeek V4 模型中引入的一种&lt;strong&gt;多头残差混合机制&lt;/strong&gt;。它将传统 Transformer 中单一的残差向量扩展为 $M$ 个并行的残差副本（multi-head residual），并在每个 block 前后通过可学习的门控和组合矩阵对多头残差进行变换。&lt;/p&gt;
&lt;p&gt;本文以 &lt;code&gt;mhc_pre_torch&lt;/code&gt; 为核心，从数学公式出发逐行对照 PyTorch 代码，并延伸至 &lt;code&gt;mhc_post_torch&lt;/code&gt; 和整个 mHC 流水线，帮助读者完整理解这一算子的设计思路与实现细节。&lt;/p&gt;</description></item></channel></rss>