<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>FanZheng&#39;s Blog</title>
        <link>https://fanzheng.org</link>
        <description>FanZheng&#39;s Blog</description>
        <atom:link href="https://fanzheng.org/rss.html" rel="self" />
        <language>zh-cn</language>
        <lastBuildDate>Sat, 29 Aug 2026 05:10:31 GMT</lastBuildDate>
        <item>
            <title>Transformer之后的大模型领域进展综述——架构演进篇</title>
            <link>https://fanzheng.org/post/a-survey-of-advances-in-LLM-since-the-transformer-architecture.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#toc-863">概览</a></li><li><a href="#toc-ebb">演进方向</a></li><ul><li><a href="#toc-809">在注意力机制上搞事情：注意力效率与结构变体</a></li><ul><li><a href="#toc-e3e">早期探索（近似流派和稀疏流派）</a></li><li><a href="#toc-d13">MHA、MQA、GQA、CLA（共享KV流派）</a></li><li><a href="#toc-cb7">MLA低秩压缩（进阶版共享KV流派）</a></li><li><a href="#toc-524">可训练的稀疏注意力机制（现代稀疏流派）</a></li><li><a href="#toc-09b">线性注意力与状态空间模型（现代线性流派）</a></li><li><a href="#toc-a70">混合注意力机制</a></li></ul><li><a href="#toc-9b5">在FFN网络上搞事情：提高知识存储容量和深层网络训练稳定性</a></li><ul><li><a href="#toc-f8e">FFN扩张比</a></li><li><a href="#toc-0f5">MoE（混合专家）稀疏大模型架构</a></li><li><a href="#toc-9d3">激活函数的演进</a></li></ul><li><a href="#toc-220">在位置编码上搞事情：位置编码与长上下文扩展</a></li><ul><li><a href="#toc-d3c">从绝对位置编码到旋转位置编码</a></li><li><a href="#toc-04f">混合位置编码与NoPE</a></li></ul><li><a href="#toc-9e4">在嵌入层上搞事情：嵌入层优化也能无痛提升模型性能</a></li><ul><li><a href="#toc-6e0">大规模扩展词汇表</a></li><li><a href="#toc-488">N-gram嵌入技术</a></li></ul><li><a href="#toc-3f4">在整体架构上搞事情：后Transformer架构</a></li><ul><li><a href="#toc-98d">多Token预测（MTP）</a></li><li><a href="#toc-f0c">微观结构与训练稳定性</a></li></ul></ul><li><a href="#toc-4d8">一个实际例子</a></li></ul></div><p>在搞清楚Transformer的基本原理之后，我们再来讨论下，在Transformer之后，大模型领域有哪些变化和进展。本文作为一个初学者在学习过程中的记录，可能不一定能做到非常完整和系统。</p>
<p>Transformer之后大模型领域的变化和进展，总体来说可以分为下面这些方向：</p>
<ul>
<li>架构演进</li>
<li>推理技术</li>
<li>Scaling Law 与预训练数据工程</li>
<li>后训练与对齐</li>
<li>Agent、工具使用与外部知识</li>
<li>多模态与统一生成</li>
<li>可解释性、安全与评测</li>
<li>系统、工程与成本</li>
</ul>
<p>在这个系列中，我主要会整理、学习和总结<strong>架构演进</strong>、<strong>推理技术</strong>这两个方向的内容，并在过程中涉及一些关于<strong>系统、工程与成本</strong>的内容。</p>
<p>本文首先讨论<strong>架构演进</strong>这一方向。</p>
<h1><a id="toc-863" class="anchor" href="#toc-863"></a>概览</h1><p>自2017年Transformer提出以来，主干结构的实质改动其实有限。真正的变化几乎全部发生在架构之外：训练配方、后训练目标、推理时策略与工程系统。</p>
<p>下面我们讨论下模型主干结构的一些关键演进，而关于推理的内容将会在推理技术篇中总结，不过本篇仍或多或少涉及到一些推理的内容，毕竟推理性能也影响着模型设计本身。</p>
<h1><a id="toc-ebb" class="anchor" href="#toc-ebb"></a>演进方向</h1><h2><a id="toc-809" class="anchor" href="#toc-809"></a>在注意力机制上搞事情：注意力效率与结构变体</h2><p>在注意力机制上做的改进，核心思想都是：<strong>在尽可能不牺牲注意力效果的前提下，降低显存与访存开销。</strong></p>
<h3><a id="toc-e3e" class="anchor" href="#toc-e3e"></a>早期探索（近似流派和稀疏流派）</h3><p><strong>近似流派（利用近似改写公式以降低计算量）</strong>，例如：</p>
<ul>
<li>Performer(2020)：【线性/核函数近似】利用随机特征映射将标准自注意力的Softmax核近似分解为两个低秩特征矩阵的乘积，将复杂度降低为线性</li>
<li>Linformer(2020)：【低秩近似】用低秩投影把K/V压到固定维度，将复杂度降低为线性</li>
</ul>
<p>但是由于投影无法支持自回归、无法动态处理变长的上下文，以及不适合工程实现和硬件并行化计算等原因，均已不再单独使用。</p>
<p><strong>稀疏流派（剪枝以跳过影响较小的计算）</strong>，例如：</p>
<ul>
<li>Sparse Transformer(2019)：【稀疏注意力】采用分块和步长的网格状稀疏，Token只看自己同一块或固定间隔的Token</li>
<li>Longformer(2020)：【稀疏注意力】采用滑动窗口（局部只看邻居）+扩张滑动窗口+任务特定的全局Token 稀疏组合</li>
<li>BigBird(2020)：【稀疏注意力】继承了Longformer的局部和全局，并额外加入了随机采样，通过“局部+全局+随机”的稀疏图结构，在数学上逼近全连接的效果</li>
</ul>
<p>但是稀疏流派不利于硬件计算，显存带宽利用率极低，甚至可能还没有不做任何数学公式改动的纯工程优化方案FlashAttention速度快。</p>
<p>不过，早期的近似流派和稀疏流派的思想仍可能会可能会以混合的方式出现在现代模型中。</p>
<h3><a id="toc-d13" class="anchor" href="#toc-d13"></a>MHA、MQA、GQA、CLA（共享KV流派）</h3><p>核心目的是通过降低隐状态数量来降低KVCache体积。</p>
<ul>
<li>MHA（Multi-Head Attention）：传统多头注意力机制，每个头都有独立的Q、K、V</li>
<li>MQA（Multi-Query Attention）：让所有Q头共享唯一的一组K、V头</li>
<li>GQA（Group-Query Attention）：一种折中方案，将Q头分为多个组，一个组内的多个Q头共享相同的K、V头。若组数等于1，GQA就退化为MQA；若组数等于Q头数，GQA就等同于MHA</li>
<li>CLA（Cross-Layer Attention）：是一种在层之间共享KV的技术路线</li>
</ul>
<p>传统MHA显存和带宽消耗大，MQA效果差，GQA在中小模型与稠密模型中最普遍，而CLA更适合端侧模型。</p>
<h3><a id="toc-cb7" class="anchor" href="#toc-cb7"></a>MLA低秩压缩（进阶版共享KV流派）</h3><p>相比MQA/GQA，MLA（Multi-Head Latent Attention）不是粗暴地减少KV头数，而是对K和V进行联合低秩压缩。它在推理时缓存的不是完整的K和V，而是一个低维的隐向量，以及一个用于RoPE位置编码的共享向量（因为基于乘法的RoPE，会破坏矩阵结合律，导致矩阵吸收失效，因此需要解耦RoPE）</p>
<p>MLA本质上是把投影矩阵拆成了两个低秩矩阵的乘积，共用一个下投影矩阵<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="6.857ex" height="1.934ex" role="img" focusable="false" viewBox="0 -846.7 3030.6 854.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}^{DKV}"><g data-mml-node="msup" data-latex="\mathbf{W}^{DKV}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,363) scale(0.707)" data-latex="{D K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="D"><path data-c="1D437" d="M567 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C153 60 143 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 51 0 72 0L399 0C467 0 532 20 595 61C702 130 804 265 804 429C804 577 713 683 567 683M710 466C710 353 659 216 607 149C550 76 475 39 381 39L270 39C259 39 252 39 248 40C242 40 239 42 239 45C239 47 241 54 244 67L379 610C388 643 387 644 429 644L535 644C647 644 710 578 710 466Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(828,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(1717,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g></g></g></g></svg></mjx-container></span>：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -3.628ex;" xmlns="http://www.w3.org/2000/svg" width="22.411ex" height="5.673ex" role="img" focusable="false" viewBox="0 -903.7 9905.5 2507.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}^{K,h} \approx \mathbf{W}^{DKV} \mathbf{W}^{UK,h} \\
\mathbf{W}^{K,h} \approx \mathbf{W}^{DKV} \mathbf{W}^{UK,h}"><g data-mjx-linestack="true"><g data-mjx-linebox="true" data-mjx-lineno="0"><g data-mml-node="msup" data-latex="\mathbf{W}^{K,h}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{K,h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(889,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1167,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="\approx" transform="translate(2782.3,0)"><path data-c="2248" d="M717 432L717 434C717 445 712 450 701 450C694 450 689 446 686 439C679 404 665 377 645 360C612 331 577 317 539 317C510 317 480 328 449 349C392 390 358 413 347 420C304 445 266 457 232 457C125 457 77 382 56 284L56 281C56 271 61 266 72 266C81 266 86 270 88 278C95 313 108 339 128 356C161 385 196 399 235 399C264 399 293 388 324 366C381 326 415 303 426 296C469 271 507 259 541 259C648 259 696 334 717 432M717 216L717 219C717 229 712 234 701 234C694 234 689 230 686 223C679 188 665 162 645 144C612 115 577 101 539 101C510 101 480 112 449 134C392 174 358 197 347 204C304 229 266 241 232 241C125 241 77 166 56 68L56 66C56 55 61 50 72 50C81 50 86 54 88 62C95 97 108 123 128 140C161 169 196 183 235 183C264 183 293 172 324 151C381 110 415 87 426 80C469 55 507 43 541 43C648 43 696 118 717 216Z"/></g><g data-mml-node="msup" data-latex="\mathbf{W}^{D K V}" transform="translate(3833,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{D K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="D"><path data-c="1D437" d="M567 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C153 60 143 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 51 0 72 0L399 0C467 0 532 20 595 61C702 130 804 265 804 429C804 577 713 683 567 683M710 466C710 353 659 216 607 149C550 76 475 39 381 39L270 39C259 39 252 39 248 40C242 40 239 42 239 45C239 47 241 54 244 67L379 610C388 643 387 644 429 644L535 644C647 644 710 578 710 466Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(828,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(1717,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g></g><g data-mml-node="msup" data-latex="\mathbf{W}^{U K,h}" transform="translate(6863.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{U K,h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="U"><path data-c="1D448" d="M642 680C623 680 559 683 540 683C525 683 518 675 518 659C518 650 525 645 539 644C582 644 603 631 603 605C603 599 602 592 600 585L511 232C496 175 467 126 424 84C377 39 325 17 269 17C195 17 152 67 152 141L153 150C153 169 156 191 163 217L259 602C264 623 273 636 286 641C292 643 309 644 338 644C364 644 375 644 375 668C375 678 369 683 358 683L231 680L104 683C88 683 81 674 81 659C81 652 84 647 89 646C99 645 107 644 112 644C143 643 161 641 166 640C171 639 173 636 173 631C173 629 172 622 169 611L74 230C69 211 67 192 67 172C67 57 150-22 265-22C330-22 390 3 445 54C498 102 532 158 548 223L636 574C649 625 677 643 739 644C753 645 760 653 760 668L760 672C757 679 752 683 743 683C724 683 661 680 642 680Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(760,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1649,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1927,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mspace" data-latex="\\" transform="translate(9905.5,0)"/></g><g data-mjx-linebox="true" data-mjx-lineno="1" transform="translate(0,-1353.7)"><g data-mml-node="mspace" data-latex="\\"/><g data-mml-node="msup" data-latex="\mathbf{W}^{K,h}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{K,h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(889,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1167,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="\approx" transform="translate(2782.3,0)"><path data-c="2248" d="M717 432L717 434C717 445 712 450 701 450C694 450 689 446 686 439C679 404 665 377 645 360C612 331 577 317 539 317C510 317 480 328 449 349C392 390 358 413 347 420C304 445 266 457 232 457C125 457 77 382 56 284L56 281C56 271 61 266 72 266C81 266 86 270 88 278C95 313 108 339 128 356C161 385 196 399 235 399C264 399 293 388 324 366C381 326 415 303 426 296C469 271 507 259 541 259C648 259 696 334 717 432M717 216L717 219C717 229 712 234 701 234C694 234 689 230 686 223C679 188 665 162 645 144C612 115 577 101 539 101C510 101 480 112 449 134C392 174 358 197 347 204C304 229 266 241 232 241C125 241 77 166 56 68L56 66C56 55 61 50 72 50C81 50 86 54 88 62C95 97 108 123 128 140C161 169 196 183 235 183C264 183 293 172 324 151C381 110 415 87 426 80C469 55 507 43 541 43C648 43 696 118 717 216Z"/></g><g data-mml-node="msup" data-latex="\mathbf{W}^{D K V}" transform="translate(3833,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{D K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="D"><path data-c="1D437" d="M567 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C153 60 143 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 51 0 72 0L399 0C467 0 532 20 595 61C702 130 804 265 804 429C804 577 713 683 567 683M710 466C710 353 659 216 607 149C550 76 475 39 381 39L270 39C259 39 252 39 248 40C242 40 239 42 239 45C239 47 241 54 244 67L379 610C388 643 387 644 429 644L535 644C647 644 710 578 710 466Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(828,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(1717,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g></g><g data-mml-node="msup" data-latex="\mathbf{W}^{U K,h}" transform="translate(6863.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,413) scale(0.707)" data-latex="{U K,h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="U"><path data-c="1D448" d="M642 680C623 680 559 683 540 683C525 683 518 675 518 659C518 650 525 645 539 644C582 644 603 631 603 605C603 599 602 592 600 585L511 232C496 175 467 126 424 84C377 39 325 17 269 17C195 17 152 67 152 141L153 150C153 169 156 191 163 217L259 602C264 623 273 636 286 641C292 643 309 644 338 644C364 644 375 644 375 668C375 678 369 683 358 683L231 680L104 683C88 683 81 674 81 659C81 652 84 647 89 646C99 645 107 644 112 644C143 643 161 641 166 640C171 639 173 636 173 631C173 629 172 622 169 611L74 230C69 211 67 192 67 172C67 57 150-22 265-22C330-22 390 3 445 54C498 102 532 158 548 223L636 574C649 625 677 643 739 644C753 645 760 653 760 668L760 672C757 679 752 683 743 683C724 683 661 680 642 680Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(760,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1649,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1927,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>于是，KV会被<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="6.857ex" height="1.934ex" role="img" focusable="false" viewBox="0 -846.7 3030.6 854.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}^{DKV}"><g data-mml-node="msup" data-latex="\mathbf{W}^{DKV}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,363) scale(0.707)" data-latex="{D K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="D"><path data-c="1D437" d="M567 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C153 60 143 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 51 0 72 0L399 0C467 0 532 20 595 61C702 130 804 265 804 429C804 577 713 683 567 683M710 466C710 353 659 216 607 149C550 76 475 39 381 39L270 39C259 39 252 39 248 40C242 40 239 42 239 45C239 47 241 54 244 67L379 610C388 643 387 644 429 644L535 644C647 644 710 578 710 466Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(828,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(1717,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g></g></g></g></svg></mjx-container></span>投影成相同的低维向量被KVCache，需要的时候再通过上投影矩阵恢复。这个低维的隐向量只有一份，它被该层所有的注意力头共同读取和共享，因此<strong>MLA可以理解为一个升级版的MQA</strong>。</p>
<p>但其实它甚至不需要做恢复动作，在实际推理的decoding阶段，MLA采用了一种名为<strong>矩阵吸收</strong>的优化，将用于隐向量还原的高维升维矩阵提前融合到投影矩阵中，使得模型不需要把K和V显式还原放大。</p>
<p>对比一下原始Transformer就很明显了：</p>
<table>
<thead>
<tr>
<th align="left">机制</th>
<th align="left">注意力得分（Score）计算公式</th>
<th align="left">推理时历史Token耗费的显存</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>原始 Transformer</strong></td>
<td align="left"><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.394ex" height="2.653ex" role="img" focusable="false" viewBox="0 -922.8 2826.3 1172.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{q_t^h} \times \color{red}{(k_\tau^h)^T}"><g data-mml-node="msup" data-latex="\text{Score}^h"><g data-mml-node="mtext" data-latex="\text{Score}"><path data-c="53" d="M252 669C359 669 422 601 440 466C441 456 447 451 456 451C467 451 472 460 472 478L472 677C472 696 467 705 458 705C452 705 446 700 440 690L408 638C364 680 324 705 251 705C142 705 56 617 56 509C56 417 116 349 187 324L317 292C384 275 428 229 428 154C428 79 376 17 301 17C170 17 93 91 88 218C88 227 83 232 73 232C62 232 56 223 56 204L56 6C56-13 61-22 71-22C77-22 83-17 89-7L121 45C164 0 224-22 302-22C359-22 407-1 444 40C481 81 499 130 499 188C499 235 485 278 458 317C431 356 394 380 349 391L223 422C170 434 127 481 127 544C127 614 182 669 252 669Z"/><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z" transform="translate(556,0)"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(1000,0)"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(1500,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1892,0)"/></g><g data-mml-node="mi" transform="translate(2369,432.1) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.623ex;" xmlns="http://www.w3.org/2000/svg" width="4.634ex" height="2.554ex" role="img" focusable="false" viewBox="0 -853.7 2048.4 1128.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{q_t^h} \times \color{red}{(k_\tau^h)^T}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mstyle" fill="blue" stroke="blue" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="{q_t^h}" data-mjx-texclass="ORD"><g data-mml-node="msubsup" data-latex="q_t^h"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mi" transform="translate(535.3,363) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(479,-267.4) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.578ex;" xmlns="http://www.w3.org/2000/svg" width="7.625ex" height="2.51ex" role="img" focusable="false" viewBox="0 -853.7 3370.3 1109.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{q_t^h} \times \color{red}{(k_\tau^h)^T}"><g data-mml-node="mstyle" fill="blue" stroke="blue"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mstyle" fill="red" stroke="red" transform="translate(1000.2,0)"><g data-mml-node="TeXAtom" data-latex="{(k_\tau^h)^T}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msubsup" data-latex="k_\tau^h" transform="translate(389,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,363) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(554,-247) scale(0.707)" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g><g data-mml-node="msup" data-latex=")^T" transform="translate(1400.3,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" transform="translate(422,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g></g></g></g></svg></mjx-container></span></td>
<td align="left">存储所有头的<strong>高维</strong> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.578ex;" xmlns="http://www.w3.org/2000/svg" width="2.288ex" height="2.51ex" role="img" focusable="false" viewBox="0 -853.7 1011.3 1109.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\color{red}{k_\tau^h}"><g data-mml-node="mstyle" fill="red" stroke="red" data-latex="\color{red}{k_\tau^h}"><g data-mml-node="TeXAtom" data-latex="{k_\tau^h}" data-mjx-texclass="ORD"><g data-mml-node="msubsup" data-latex="k_\tau^h"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,363) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(554,-247) scale(0.707)" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g></g></g></g></g></svg></mjx-container></span></td>
</tr>
<tr>
<td align="left"><strong>MLA (DeepSeek)</strong></td>
<td align="left"><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.394ex" height="2.653ex" role="img" focusable="false" viewBox="0 -922.8 2826.3 1172.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{\left( q_t^h (\mathbf{W}^{UK,h})^T \right)} \times \color{red}{(c_\tau^{KV})^T}"><g data-mml-node="msup" data-latex="\text{Score}^h"><g data-mml-node="mtext" data-latex="\text{Score}"><path data-c="53" d="M252 669C359 669 422 601 440 466C441 456 447 451 456 451C467 451 472 460 472 478L472 677C472 696 467 705 458 705C452 705 446 700 440 690L408 638C364 680 324 705 251 705C142 705 56 617 56 509C56 417 116 349 187 324L317 292C384 275 428 229 428 154C428 79 376 17 301 17C170 17 93 91 88 218C88 227 83 232 73 232C62 232 56 223 56 204L56 6C56-13 61-22 71-22C77-22 83-17 89-7L121 45C164 0 224-22 302-22C359-22 407-1 444 40C481 81 499 130 499 188C499 235 485 278 458 317C431 356 394 380 349 391L223 422C170 434 127 481 127 544C127 614 182 669 252 669Z"/><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z" transform="translate(556,0)"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(1000,0)"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(1500,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1892,0)"/></g><g data-mml-node="mi" transform="translate(2369,432.1) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.672ex;" xmlns="http://www.w3.org/2000/svg" width="16.5ex" height="2.603ex" role="img" focusable="false" viewBox="0 -853.7 7293.1 1150.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{\left( q_t^h (\mathbf{W}^{UK,h})^T \right)} \times \color{red}{(c_\tau^{KV})^T}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mstyle" fill="blue" stroke="blue" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="{\left( q_t^h (\mathbf{W}^{UK,h})^T \right)}" data-mjx-texclass="ORD"><g data-mml-node="mrow" data-latex="\left( q_t^h (\mathbf{W}^{UK,h})^T \right)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M348-297C357-297 362-292 362-283C362-278 360-275 357-272C301-229 256-157 222-56C193 31 178 115 178 198L178 302C178 385 193 469 222 556C256 657 301 729 357 772C360 775 362 778 362 783C362 792 357 797 348 797C344 797 341 796 340 794C275 744 221 670 178 571C137 477 116 387 116 302L116 198C116 113 137 23 178-71C221-170 275-244 340-294C341-296 344-297 348-297Z"/></g><g data-mml-node="msubsup" data-latex="q_t^h" transform="translate(422,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mi" transform="translate(535.3,363) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(479,-267.4) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1414.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msup" data-latex="\mathbf{W}^{U K,h}" transform="translate(1803.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,363) scale(0.707)" data-latex="{U K,h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="U"><path data-c="1D448" d="M642 680C623 680 559 683 540 683C525 683 518 675 518 659C518 650 525 645 539 644C582 644 603 631 603 605C603 599 602 592 600 585L511 232C496 175 467 126 424 84C377 39 325 17 269 17C195 17 152 67 152 141L153 150C153 169 156 191 163 217L259 602C264 623 273 636 286 641C292 643 309 644 338 644C364 644 375 644 375 668C375 678 369 683 358 683L231 680L104 683C88 683 81 674 81 659C81 652 84 647 89 646C99 645 107 644 112 644C143 643 161 641 166 640C171 639 173 636 173 631C173 629 172 622 169 611L74 230C69 211 67 192 67 172C67 57 150-22 265-22C330-22 390 3 445 54C498 102 532 158 548 223L636 574C649 625 677 643 739 644C753 645 760 653 760 668L760 672C757 679 752 683 743 683C724 683 661 680 642 680Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(760,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1649,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1927,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="msup" data-latex=")^T" transform="translate(4845.5,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" transform="translate(422,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(5815.3,0)"><path data-c="29" d="M82-294C147-244 201-170 244-71C285 23 306 113 306 198L306 302C306 387 285 477 244 571C201 670 147 744 82 794C81 796 78 797 74 797C65 797 60 792 60 783C60 778 62 775 65 772C121 729 166 657 200 556C229 469 244 385 244 302L244 198C244 115 229 31 200-56C166-157 121-229 65-272C62-275 60-278 60-283C60-292 65-297 74-297C78-297 81-296 82-294Z"/></g></g></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.578ex;" xmlns="http://www.w3.org/2000/svg" width="9.159ex" height="2.494ex" role="img" focusable="false" viewBox="0 -846.7 4048.1 1102.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{Score}^h = \color{blue}{\left( q_t^h (\mathbf{W}^{UK,h})^T \right)} \times \color{red}{(c_\tau^{KV})^T}"><g data-mml-node="mstyle" fill="blue" stroke="blue"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mstyle" fill="red" stroke="red" transform="translate(1000.2,0)"><g data-mml-node="TeXAtom" data-latex="{(c_\tau^{K V})^T}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msubsup" data-latex="c_\tau^{K V}" transform="translate(389,0)"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="TeXAtom" transform="translate(466,363) scale(0.707)" data-latex="{K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(889,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g><g data-mml-node="mi" transform="translate(466,-247) scale(0.707)" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g><g data-mml-node="msup" data-latex=")^T" transform="translate(2078.1,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" transform="translate(422,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g></g></g></g></svg></mjx-container></span></td>
<td align="left">仅存储所有头共享的<strong>低维</strong> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.578ex;" xmlns="http://www.w3.org/2000/svg" width="3.821ex" height="2.494ex" role="img" focusable="false" viewBox="0 -846.7 1689.1 1102.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\color{red}{c_\tau^{KV}}"><g data-mml-node="mstyle" fill="red" stroke="red" data-latex="\color{red}{c_\tau^{KV}}"><g data-mml-node="TeXAtom" data-latex="{c_\tau^{K V}}" data-mjx-texclass="ORD"><g data-mml-node="msubsup" data-latex="c_\tau^{K V}"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="TeXAtom" transform="translate(466,363) scale(0.707)" data-latex="{K V}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" data-latex="V" transform="translate(889,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g><g data-mml-node="mi" transform="translate(466,-247) scale(0.707)" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g></g></g></g></g></svg></mjx-container></span></td>
</tr>
</tbody></table>
<p>MLA能奏效的核心原因是，不同头的隐状态中的信息密度其实没有那么高，所以才能压缩。</p>
<p>但是如开头所说，RoPE位置信息要单独携带，无法融入其中。因此除了一个低维的隐向量以外，还需要一个用于RoPE位置编码的共享向量。</p>
<p>最后是一个在工程实现上的点：矩阵吸收本质上是改变了升维矩阵的结合方式（是否要与Q结合）。如果Q少，就可以吸收（与Q结合），牺牲计算换取更小的显存带宽消耗；如果Q多，就不需要吸收。因此矩阵吸收通常只在推理decode阶段做，而在prefill或者训练阶段不做。</p>
<h3><a id="toc-524" class="anchor" href="#toc-524"></a>可训练的稀疏注意力机制（现代稀疏流派）</h3><div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>MLA解决了隐状态的压缩问题，稀疏注意力机制主要解决对哪些KV产生注意力的问题。</p>
</div>
<p>稀疏注意力这一方向核心要解决的问题有几个：</p>
<ul>
<li>稀疏注意力gather操作与GQA等共享KV的访存模式冲突（最怕的就是每个头挑的token不一样导致KV没法共享），破坏内存合并访问，瓶颈从算力变成了不规则访存</li>
<li>往往只对prefill和decode的其中之一有加速，很难兼顾</li>
<li>稀疏注意力本质上要做离散选择，常见做法不可微，无法预训练</li>
</ul>
<p>一种最简单的稀疏注意力机制，就是<strong>局部注意力</strong>，采用类似于<strong>滑动窗口</strong>的形式，简单粗暴。</p>
<p>随着研究深入，<strong>可训练的稀疏注意力机制被提出</strong>，典型方法如下：</p>
<ul>
<li>NSA（Native Sparse Attention，DeepSeek 2025-02）：引入三分支门控，三个分支的输出用一个学出来的门控加权求和，模型自己决定每层每头更依赖哪条路<ul>
<li>压缩分支：用可学习MLP聚合连续KV块，即把KV序列按连续块切开，每块用一个可学习的MLP压成一个代表性的K/V，Q对这些块摘要做全注意力</li>
<li>选择分支：只看摘要毕竟有损，所以再从所有块里挑top n个最相关的，对这些块内的原始token做精确注意力（top n的选择复用压缩分支算出来的注意力分数），因为分数来自可学习的MLP，所以它可微分<blockquote>
<p><strong>为了不与GQA产生冲突</strong>，NSA选择让同一个组内的多个Q头的打分做平均，从而合并为相同的决策。只有选择分支有这个问题，其他两个分支不会有冲突。<br>如果不这么做，极端情况下访存开销退化到与没有用NSA一样的情况，这是因为：每个头的矩阵计算是独立的，如果Q头对应的KV切片一样，就可以复用；如果不一样，就还要把所有需要的KV切片拉出来</p>
</blockquote>
</li>
<li>滑窗分支：保留单独的近邻处理，防止局部模式吞掉长程学习</li>
</ul>
</li>
<li>MoBA（Mixture of Block Attention，Moonshot 2025-02）：把MoE搬到注意力上，采用无参数门控（Q与块内K均值池化的点积）取top n个块。它没有增加可训练的参数，但是稀疏pattern本身是被训练出来的</li>
<li>DSA（DeepSeek Sparse Attention，DeepSeek 2025-09）：在注意力前加一个带参数的选路器（Lightning‑Indexer），先快速判断历史上哪些token值得关注，只把这部分送进真正的MLA注意力<blockquote>
<p>由于DSA直接把索引也做成per-token、全head共享的，所有head共享一份top n列表，因此它可以与MLA直接集成<br>由于top n操作不可微，所以训练时会麻烦一些，需要分两步解决，先不开稀疏训练，再打开稀疏并通过计算图detach完成训练</p>
</blockquote>
</li>
</ul>
<p>但并不是每个方法都能与GQA/MLA同时使用的，所以在方案设计和选择上，与其他方法的冲突问题也是必须要考虑的。</p>
<p>从以上内容可以看出，各类方法其实已经在有机融合。</p>
<blockquote>
<p>再额外提一下Attention‑Sink现象：模型会天然把大量注意力权重分配给序列开头少数几个token，和语义无关，是RoPE+softmax归一化带来的模型固有行为<br>针对Attention‑Sink现象，有一些不同的做法：有些模型会将这个现象显式化，也有一些模型会反向消除它<br>StreamingLLM就是利用Attention‑Sink现象，推理时强制永久保留前N个sink token并结合滑动窗口策略，是一种固定模式稀疏注意力机制</p>
</blockquote>
<p>原生可训练稀疏已成为长上下文主流路径之一，且明显趋势是稀疏性向训练早期迁移（训练时就开启稀疏）。</p>
<h3><a id="toc-09b" class="anchor" href="#toc-09b"></a>线性注意力与状态空间模型（现代线性流派）</h3><p>核心问题：<strong>能否用线性复杂度、固定大小状态的机制替代全注意力</strong>。</p>
<ul>
<li><strong>线性注意力</strong>：通过一个映射函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.348ex" height="2.034ex" role="img" focusable="false" viewBox="0 -694 596 899"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\phi"><g data-mml-node="mi" data-latex="\phi"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g></g></g></svg></mjx-container></span>，把<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="14.798ex" height="2.465ex" role="img" focusable="false" viewBox="0 -841.7 6540.8 1089.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\text{softmax}(QK^T)"><g data-mml-node="mtext" data-latex="\text{softmax}"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3450,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="Q" transform="translate(3839,0)"><path data-c="1D444" d="M306-24C335-24 366-19 399-10C396-48 395-72 395-81C395-156 424-194 481-194C542-194 589-145 612-100C637-48 650-14 650 2C650 11 645 16 635 16C628 16 623 12 620 3C605-43 564-90 508-90C457-90 450-49 442 6C526 39 597 96 654 178C711 260 740 345 740 434C740 513 717 577 670 628C623 679 561 705 484 705C431 705 378 692 325 665C217 612 138 528 87 415C62 358 49 302 49 245C49 88 151-24 306-24M645 466C645 405 630 335 600 254C565 161 511 92 436 48C432 70 426 90 418 108C405 138 381 153 346 153C291 153 241 103 241 48C241 39 242 30 244 23C177 54 144 117 144 213C144 255 152 306 169 366C204 493 267 583 358 636C401 660 441 672 478 672C588 672 645 581 645 466M346 123C383 123 402 96 402 43C402 34 399 29 393 27C365 15 338 9 312 9C284 9 270 22 270 48C270 86 308 123 346 123Z"/></g><g data-mml-node="msup" data-latex="K^T" transform="translate(4630,0)"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mi" transform="translate(974,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6151.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>拆解为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="11.332ex" height="2.465ex" role="img" focusable="false" viewBox="0 -841.7 5008.8 1089.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\phi(Q)\phi(K)^T"><g data-mml-node="mi" data-latex="\phi"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(596,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="Q" transform="translate(985,0)"><path data-c="1D444" d="M306-24C335-24 366-19 399-10C396-48 395-72 395-81C395-156 424-194 481-194C542-194 589-145 612-100C637-48 650-14 650 2C650 11 645 16 635 16C628 16 623 12 620 3C605-43 564-90 508-90C457-90 450-49 442 6C526 39 597 96 654 178C711 260 740 345 740 434C740 513 717 577 670 628C623 679 561 705 484 705C431 705 378 692 325 665C217 612 138 528 87 415C62 358 49 302 49 245C49 88 151-24 306-24M645 466C645 405 630 335 600 254C565 161 511 92 436 48C432 70 426 90 418 108C405 138 381 153 346 153C291 153 241 103 241 48C241 39 242 30 244 23C177 54 144 117 144 213C144 255 152 306 169 366C204 493 267 583 358 636C401 660 441 672 478 672C588 672 645 581 645 466M346 123C383 123 402 96 402 43C402 34 399 29 393 27C365 15 338 9 312 9C284 9 270 22 270 48C270 86 308 123 346 123Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1776,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="\phi" transform="translate(2165,0)"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2761,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(3150,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="msup" data-latex=")^T" transform="translate(4039,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" transform="translate(422,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g></svg></mjx-container></span>，然后利用结合律先计算<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="8.176ex" height="2.465ex" role="img" focusable="false" viewBox="0 -841.7 3613.8 1089.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\phi(K)^TV"><g data-mml-node="mi" data-latex="\phi"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(596,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="K" transform="translate(985,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="msup" data-latex=")^T" transform="translate(1874,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" transform="translate(422,363) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="V" transform="translate(2843.8,0)"><path data-c="1D449" d="M671 680C652 680 592 683 573 683C558 683 550 675 550 660C550 650 557 645 570 644C598 643 612 633 612 616C612 607 607 595 598 580L300 107L234 619C234 636 255 644 298 644C318 644 327 651 327 668C327 678 321 683 309 683C287 683 209 680 187 680C167 680 99 683 79 683C64 683 56 675 56 660C56 649 66 644 85 644C102 644 114 642 122 640C138 635 137 633 140 614L218 4C221-13 229-22 242-22C255-22 265-15 273-2L629 564C652 600 674 623 696 632C711 639 730 643 752 644C763 645 768 652 769 667C770 678 764 683 752 683C737 683 686 680 671 680Z"/></g></g></g></svg></mjx-container></span>，使得中间状态的大小只与维度有关而与序列长度<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.993ex" height="1.545ex" role="img" focusable="false" viewBox="0 -683 881 683"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="N"><g data-mml-node="mi" data-latex="N"><path data-c="1D441" d="M864 683C845 683 783 680 764 680C745 680 682 683 663 683C648 683 641 675 641 659C641 650 648 645 663 644C705 644 726 631 726 605C726 599 725 592 724 585L616 157L401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659C200 649 211 644 232 644C274 644 295 643 296 640L163 110C154 71 131 49 95 42C69 39 39 43 39 15C39 5 45 0 56 0C74 0 136 3 155 3C174 3 238 0 257 0C272 0 279 8 279 24C279 33 271 38 255 39C214 40 194 53 194 78C194 83 195 90 197 100L326 611L576 21C582 7 590 0 599 0C608 0 614 8 618 24L757 574C770 625 798 643 860 644C874 645 881 653 881 669C878 678 877 683 864 683Z"/></g></g></g></svg></mjx-container></span>无关，计算复杂度直接降为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="5.335ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2358 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(N)"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="N" transform="translate(1088,0)"><path data-c="1D441" d="M864 683C845 683 783 680 764 680C745 680 682 683 663 683C648 683 641 675 641 659C641 650 648 645 663 644C705 644 726 631 726 605C726 599 725 592 724 585L616 157L401 662C393 681 391 683 366 683L233 683C209 683 200 681 200 659C200 649 211 644 232 644C274 644 295 643 296 640L163 110C154 71 131 49 95 42C69 39 39 43 39 15C39 5 45 0 56 0C74 0 136 3 155 3C174 3 238 0 257 0C272 0 279 8 279 24C279 33 271 38 255 39C214 40 194 53 194 78C194 83 195 90 197 100L326 611L576 21C582 7 590 0 599 0C608 0 614 8 618 24L757 574C770 625 798 643 860 644C874 645 881 653 881 669C878 678 877 683 864 683Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1969,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span><blockquote>
<p>它与RNN的核心区别是，RNN是把全部历史压缩成一个向量，而线性注意力本质是快速权重，存储K到V的映射矩阵，用于与Q相乘得到结果<br>线性注意力在训练阶段能够并行的核心原因是它的递归转移满足结合律，因此可以直接分块并行，而RNN不行</p>
</blockquote>
</li>
<li><strong>状态空间模型（SSM）</strong>：类似RNN，把文本序列压缩进一个能够随时间不断更新的隐状态中，但它<strong>不在隐状态的传递上引入非线性激活函数</strong>，而是在外部引入非线性，从而在支持并行计算的情况下提升表达能力（训练时并行，推理时像RNN一样串行），属于一种特殊的RNN<blockquote>
<p>SSM的隐状态迭代本质上就是线性层的叠加。<br>对于静态SSM（每个线性层参数固定），该计算就是卷积，可以直接并行。<br>对于动态SSM（每个线性层随着输入动态变化，称为选择性机制），可以通过并行扫描（前缀和）来并行。</p>
</blockquote>
</li>
</ul>
<p>线性注意力与状态空间模型在数学本质上是对等的关系。它们是从不同的视角（注意力视角、循环视角）去描述同一个计算逻辑，并在现代架构中走向了深度融合。</p>
<p>接下来分别介绍两个方向的典型模型，并不完全是最新的，后面还有一些衍生版本，但核心思想一致。</p>
<p><strong>状态空间模型Mamba</strong>：属于动态选择性SSM，SSM参数由输入动态生成，自主控制历史信息的留存与丢弃；训练借助并行扫描实现序列并行，推理以固定大小隐状态迭代，无膨胀KVCache，为线性复杂度，再通过硬件定制kernel增强性能；整体是用状态更新机制替代Transformer自注意力</p>
<p><strong>线性注意力Gated DeltaNet</strong>：区别于普通线性注意力的简单累加KV信息，它引入动态门控+增量Delta更新机制，模型会先通过输入自适应门控衰减、遗忘冗余的历史记忆，再仅用新token的残差信息修正、更新固定尺寸的记忆状态，而非无脑叠加新信息</p>
<h3><a id="toc-a70" class="anchor" href="#toc-a70"></a>混合注意力机制</h3><p>很显然，GQA和MLA这种由于作用对象不同（一个是降低KV隐状态大小，一个是降低参与注意力计算的历史KV数量），其实是可以融合使用的。</p>
<p>事实上，线性注意力与全注意力也是可以混合使用的。例如新发布的<a href="https://huggingface.co/Qwen/Qwen3.8-Flash-Next">Qwen3.8-Flash-Next</a>就同时使用了线性注意力GDN（Gated DeltaNet）层与稀疏注意力QSA（Qwen Sparse Attention）层按3:1的比例交替堆叠，且稀疏注意力使用了MQA索引器结构。</p>
<p>混合注意力已成为新常态。</p>
<p>混合架构核心需要考虑几个问题：线性注意力与全注意力的配比与排布、稀疏还是全局、位置编码归谁、是否叠加MoE等。</p>
<h2><a id="toc-9b5" class="anchor" href="#toc-9b5"></a>在FFN网络上搞事情：提高知识存储容量和深层网络训练稳定性</h2><h3><a id="toc-f8e" class="anchor" href="#toc-f8e"></a>FFN扩张比</h3><p>在Transformer架构中，每个注意力层后面都紧跟着一个FFN层。FFN扩张比代表了FFN隐藏层（中间层）的维度与模型主隐层（输入/输出）维度之间的比例关系。</p>
<p><code>intermediate_size</code>与<code>hidden_size</code>之比就是FFN扩张比。</p>
<h3><a id="toc-0f5" class="anchor" href="#toc-0f5"></a>MoE（混合专家）稀疏大模型架构</h3><p>其核心要解决的问题是：如何让模型容纳更多知识而不等比例增加推理成本。</p>
<p>具体做法是把每层FFN换成多个专家FFN，由router决策每个token激活其中的哪些，且只激活其中少数几个。</p>
<p>MoE的本质就是将FFN层的总扩张比做到了几十倍甚至上百倍（拥有海量的隐藏神经元作为参数容器），但通过稀疏路由机制，让每个token在前向传播时只激活其中的一小部分专家，这在隐式上完成了前所未有的超高维投影。</p>
<p>以DeepSeek-V3为例，671B总参数、每层256个专家、激活9个（1共享+8路由），激活参数仅37B，却比稠密的405BLlama 3更强且推理更省。其中共享专家是指始终保持激活状态、不参与动态路由选择、负责捕获和整合全局通用知识的固定专家模块。</p>
<p>一个现象是<strong>稀疏度在持续走高</strong>：</p>
<table>
<thead>
<tr>
<th align="left">模型方案</th>
<th align="left">总参数量 (Total)</th>
<th align="left">激活参数量 (Active)</th>
<th align="left">激活比例</th>
<th align="left">专家设计特点</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>Mixtral 8x7B</strong> (2023底)</td>
<td align="left">47B</td>
<td align="left">13B</td>
<td align="left"><strong>~27.6%</strong></td>
<td align="left">8个粗粒度专家，Top-2 路由</td>
</tr>
<tr>
<td align="left"><strong>DeepSeek-V3</strong> (2024年底)</td>
<td align="left">671B</td>
<td align="left">37B</td>
<td align="left"><strong>~5.5%</strong></td>
<td align="left">256个细粒度专家 + 1个共享专家</td>
</tr>
<tr>
<td align="left"><strong>Llama 4 Maverick</strong> (2025/2026)</td>
<td align="left">400B</td>
<td align="left">17B</td>
<td align="left"><strong>~4.25%</strong></td>
<td align="left">128个细粒度专家，极高稀疏性</td>
</tr>
<tr>
<td align="left"><strong>GLM-5.2</strong> (2026年中)</td>
<td align="left">~744B</td>
<td align="left">40B</td>
<td align="left"><strong>~5.3%</strong></td>
<td align="left">256个细粒度专家，Top-8 路由</td>
</tr>
<tr>
<td align="left"><strong>DeepSeek V4-Pro</strong> (2026年中)</td>
<td align="left">1.6T</td>
<td align="left">49B</td>
<td align="left"><strong>~3.0%</strong></td>
<td align="left">385个专家中仅激活6个</td>
</tr>
</tbody></table>
<p>MoE也有几个固有难题：</p>
<ul>
<li>路由与负载均衡（常见解法是辅助损失、无辅助损失均衡策略）</li>
<li>专家并行（Expert Parallelism, EP）带来的All-to-All通信开销</li>
<li>硬件资源的错配（显存要按总参数算但算力要按激活参数算）</li>
</ul>
<h3><a id="toc-9d3" class="anchor" href="#toc-9d3"></a>激活函数的演进</h3><p>早期我们想要在FFN上实现非线性使用的是ReLU。当前，SwiGLU已成为事实上的标准激活函数配置。</p>
<p>SwiGLU采用双支路并行设计（一路传输原始特征，另一路通过Swish/SiLU激活函数生成0-1之间的门控权重），两路逐元素相乘。这类似于一个可学习的注意力开关，让模型能够自适应地筛选重要语义并压制冗余噪声。彻底解决了ReLU的神经元永久死亡、梯度不稳定问题，以及GELU在深层网络中非线性拟合上限低、训练后期容易饱和的硬伤。</p>
<h2><a id="toc-220" class="anchor" href="#toc-220"></a>在位置编码上搞事情：位置编码与长上下文扩展</h2><p>要解决的核心问题是：位置信息如何注入才能泛化到训练时未见过的长度；以及窗口做大之后，模型是否真的能用好其中的信息。</p>
<h3><a id="toc-d3c" class="anchor" href="#toc-d3c"></a>从绝对位置编码到旋转位置编码</h3><p>Transformer原文使用的是三角函数绝对位置编码，当前旋转位置编码RoPE已逐渐成为事实标准。</p>
<p>RoPE有几个十分优雅且重要的特性：</p>
<ul>
<li><strong>完美结合绝对与相对位置</strong>：它通过将词元向量在二维子空间中进行旋转，使模型既能感知每个词的绝对位置，又能在计算注意力点积时自动暴露出两个词之间的相对距离</li>
<li><strong>支持长文本外推</strong>：RoPE理论上支持无限长度，使得模型可以零开销或通过极少量的续训，将上下文直接暴力扩展</li>
<li><strong>极致的计算效率</strong>：RoPE属于零参数机制，不增加训练负担；同时它的数学形式可以完美借助FlashAttention等现代GPU算子进行硬件级加速，几乎没有推理性能惩罚</li>
</ul>
<p>再来详细分析一下RoPE为什么支持长文本外推：</p>
<p>RoPE的<code>rope_theta</code>在推理时可以根据需要修改。RoPE的数学推导证明了，Q和K乘以旋转矩阵后，进行点积运算时，绝对位置被消去了，只留下了相对位置差。不是像三角函数位置编码是一个绝对位置的概念。当调大<code>rope_theta</code>时相当于把整个特征空间里的相对距离等比例缩小或平滑拉伸了装置注意力机制来说，它看到的只是注意力权重矩阵的波形变得稍微平缓了一点，依然能识别出谁和谁应该产生注意力，模型已经学会了理解这种pattern。</p>
<p>不过这种操作也不是没有代价的：虽然调大后会减缓长距离注意力衰减，但是会牺牲短文本的局部精确度。</p>
<p>这种操作虽然可用，但如果是想要保障长文本的效果，通常必须配合一定量的长文本数据进行继续预训练或微调。</p>
<h3><a id="toc-04f" class="anchor" href="#toc-04f"></a>混合位置编码与NoPE</h3><p>NoPE的核心洞察是：因果掩码本身就携带顺序信息（第t个token只能看到前t-1个token信息），这个可见计数就是位置，因此理论上NoPE可表达绝对与相对位置编码。</p>
<p>当然，理论是理论，实践是实践。NoPE与逐层差异化是近期的趋势。</p>
<p>实际落地的混合做法有四种形态：</p>
<ul>
<li>不同层不同base（<code>rope_theta</code>）</li>
<li>RoPE与NoPE按层交错</li>
<li>把位置职责整体外包，注意力放弃位置建模，交给注意力以外的模型结构处理</li>
<li>部分RoPE，让部分维度不旋转<blockquote>
<p>朴素的想法是：编码位置所需的维度远少于编码语义，留一批无位置信息的通道是有价值的
例如MLA中，由于RoPE无法压缩，因此拆出小维度做RoPE，剩下保持无位置便于应用MLA</p>
</blockquote>
</li>
</ul>
<h2><a id="toc-9e4" class="anchor" href="#toc-9e4"></a>在嵌入层上搞事情：嵌入层优化也能无痛提升模型性能</h2><h3><a id="toc-6e0" class="anchor" href="#toc-6e0"></a>大规模扩展词汇表</h3><h3><a id="toc-488" class="anchor" href="#toc-488"></a>N-gram嵌入技术</h3><h2><a id="toc-3f4" class="anchor" href="#toc-3f4"></a>在整体架构上搞事情：后Transformer架构</h2><h3><a id="toc-98d" class="anchor" href="#toc-98d"></a>多Token预测（MTP）</h3><h3><a id="toc-f0c" class="anchor" href="#toc-f0c"></a>微观结构与训练稳定性</h3><p>参数量配比</p>
<p>已成既定标准的内部改动包括：Pre-LN 取代 Post-LN（Xiong et al. 2020 证明其初始化时梯度更良性且无需精心设计的学习率 warmup）、RMSNorm 取代 LayerNorm、SwiGLU 类门控激活、QK-Norm（在 RoPE 之前对 q/k 做 RMSNorm，可追溯至 2023 年 Scaling Vision Transformers）。有意思的是 OLMo 2 反其道采用 Post-Norm 变体（norm 移到注意力/FFN 之后但仍在残差连接内部）以提升训练稳定性，OLMo 3 延续了该选择；Gemma 3 则在注意力模块前后都放 RMSNorm，兼取两者之长 [2]。</p>
<p>门控残差连接是一种在标准残差连接基础上引入门控机制的神经网络结构</p>
<h1><a id="toc-4d8" class="anchor" href="#toc-4d8"></a>一个实际例子</h1>
            ]]></description>
            <pubDate>Fri, 28 Aug 2026 11:22:45 GMT</pubDate>
            <guid>https://fanzheng.org/post/a-survey-of-advances-in-LLM-since-the-transformer-architecture.html</guid>
        </item>
        <item>
            <title>古法手撕简易LLM推理器</title>
            <link>https://fanzheng.org/post/gu-fa-shou-si-jian-yi-LLM-tui-li-qi.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#toc-ab1">模型结构</a></li><li><a href="#toc-381">实现</a></li><ul><li><a href="#toc-a52">tokenize逻辑</a></li><li><a href="#toc-f4d">处理参数和超参数</a></li><li><a href="#toc-2ac">工具函数</a></li><li><a href="#toc-c6e">核心计算函数与Transformer层</a></li><li><a href="#toc-651">prefill与predict</a></li><li><a href="#toc-64d">构造输入</a></li><li><a href="#toc-4ba">发起预测</a></li></ul><li><a href="#toc-c33">性能</a></li><li><a href="#toc-e1f">在过程中遇到的问题</a></li><ul><li><a href="#toc-7e7">RoPE的细节</a></li></ul></ul></div><p>深度学习学完Transformer之后，决定古法手撕一个推理器出来，亲自做一遍可以验证自己的理解是否存在偏差，并且对各类细节有更深入和更系统的了解。</p>
<p>我选择Qwen3-0.6B模型实现推理器，并在我的3070Ti(8GB)上验证。</p>
<p>整体仅使用pytorch的张量计算，不使用任何其他高级封装函数。但在参数读取和tokenize方面，使用了Hugging Face的safetensors库读取模型权重，以及tokenizers库实现文本与token id之间的转换，省去了基于<code>tokenizer.json</code>处理BPE词表的merges的步骤，更关注于推理器的实现。总代码约200多行。</p>
<p><a href="/static/upload/20260822/transformer.py">完整代码&gt;&gt;</a></p>
<p><a href="/static/upload/20260822/transformer.html">完整输出结果（Jupyter Notebook）&gt;&gt;</a></p>
<h1><a id="toc-ab1" class="anchor" href="#toc-ab1"></a>模型结构</h1><p>首先要看模型结构，图片来自<a href="https://sebastianraschka.com/llm-architecture-gallery/#architecture-gallery">LLM Architecture Gallery</a>：</p>
<p class="firekylin-markdown-img-only"><img src="https://fanzheng.org/static/upload/20260822/upload_73edba59d2cf674668dd08e349f72c91.png" alt="image.png"></p>
<p>相比Transformer原始论文中的实现，主要有以下几点变化：</p>
<ul>
<li>采用RMSNorm而非LayerNorm，不再减去均值</li>
<li>残差连接与RMSNorm的位置与原文有略微差异</li>
<li>采用旋转位置编码RoPE而非三角函数位置编码</li>
<li>额外引入对Q/K的RMSNorm</li>
<li>Q与K/V的注意力头数不一样，需要对K/V做交错式repeat</li>
<li>前馈神经网络FFN采用SwiGLU门控前馈网络，引入了门控机制并采用SiLU作为激活函数</li>
</ul>
<h1><a id="toc-381" class="anchor" href="#toc-381"></a>实现</h1><p>整体拆解成下面这些步骤和模块：</p>
<h2><a id="toc-a52" class="anchor" href="#toc-a52"></a>tokenize逻辑</h2><p>借助Hugging Face的tokenizers库快速实现文本与token id之间的转换。</p>
<pre><code class="hljs lang-python">DIR = <span class="hljs-string">&quot;../models/HuggingFace/Qwen3-0.6B&quot;</span>

<span class="hljs-keyword">from</span> tokenizers <span class="hljs-keyword">import</span> Tokenizer

tokenizer = Tokenizer.from_file(DIR + <span class="hljs-string">&quot;/tokenizer.json&quot;</span>)
output = tokenizer.encode(<span class="hljs-string">&quot;测试一下tokenizer的效果&quot;</span>)
<span class="hljs-built_in">print</span>(output.ids)
tokenizer.decode(output.ids)
</code></pre><h2><a id="toc-f4d" class="anchor" href="#toc-f4d"></a>处理参数和超参数</h2><p>从<code>model.safetensors</code>和<code>config.json</code>中读取参数和超参数。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">from</span> safetensors <span class="hljs-keyword">import</span> safe_open
<span class="hljs-keyword">import</span> json
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># 常数和超参数</span>
eos_token_id: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># 用于判断模型输出完的token id</span>
rms_norm_eps: <span class="hljs-built_in">float</span>  <span class="hljs-comment"># RMSNorm防止归一化分母为0的eps</span>
rope_theta: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># RoPE的theta的底数部分</span>
num_hidden_layers: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># transformer层数</span>
num_attention_heads: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># Q的注意力头数</span>
num_key_value_heads: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># KV的注意力头数</span>
head_dim: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># 单头注意力维数</span>
max_position_embeddings: <span class="hljs-built_in">int</span>  <span class="hljs-comment"># 允许位置编码的最大序列长度</span>

<span class="hljs-comment"># 参数</span>
E: torch.Tensor  <span class="hljs-comment"># 嵌入层</span>
Gamma_finalRMSNorm: torch.Tensor  <span class="hljs-comment"># 最终RMSNorm的缩放系数</span>
W_output: torch.Tensor  <span class="hljs-comment"># 最终投影到词表大小的线性层</span>
Gamma_inputRMSNorm: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中对输入的RMSNorm的缩放系数</span>
Gamma_postATTNRMSNorm: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中对自注意力结果的RMSNorm的缩放系数</span>
W_FFNGate: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中FFN的门控层</span>
W_FFNUp: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中FFN的升维层</span>
W_FFNDown: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中FFN的降维层</span>
Gamma_QRMSNorm: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中Q投影后、RoPE前的每个头的RMSNorm的缩放系数</span>
Gamma_KRMSNorm: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中K投影后、RoPE前的每个头的RMSNorm的缩放系数</span>
W_Q: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中Q投影矩阵</span>
W_K: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中K投影矩阵</span>
W_V: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中V投影矩阵</span>
W_O: <span class="hljs-built_in">list</span>[torch.Tensor] = []  <span class="hljs-comment"># transformer层中O投影矩阵</span>

<span class="hljs-comment"># 读取常数和超参数</span>
<span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(DIR + <span class="hljs-string">&quot;/config.json&quot;</span>, <span class="hljs-string">&quot;r&quot;</span>, encoding=<span class="hljs-string">&quot;utf-8&quot;</span>) <span class="hljs-keyword">as</span> f:
    data = json.load(f)

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">readParam</span>(<span class="hljs-params">name, t</span>):
        d = data.get(name)
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> <span class="hljs-built_in">isinstance</span>(d, t):
            <span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">f&quot;get <span class="hljs-subst">{name}</span> error&quot;</span>)
        <span class="hljs-keyword">return</span> d

    eos_token_id = readParam(<span class="hljs-string">&quot;eos_token_id&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 151645</span>
    rms_norm_eps = readParam(<span class="hljs-string">&quot;rms_norm_eps&quot;</span>, <span class="hljs-built_in">float</span>)  <span class="hljs-comment"># 1e-06</span>
    rope_theta = readParam(<span class="hljs-string">&quot;rope_theta&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 1000000</span>
    num_hidden_layers = readParam(<span class="hljs-string">&quot;num_hidden_layers&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 28</span>
    num_attention_heads = readParam(<span class="hljs-string">&quot;num_attention_heads&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 16</span>
    num_key_value_heads = readParam(<span class="hljs-string">&quot;num_key_value_heads&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 8</span>
    head_dim = readParam(<span class="hljs-string">&quot;head_dim&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 128</span>
    max_position_embeddings = readParam(<span class="hljs-string">&quot;max_position_embeddings&quot;</span>, <span class="hljs-built_in">int</span>)  <span class="hljs-comment"># 40960</span>

<span class="hljs-comment"># 读取参数</span>
<span class="hljs-keyword">with</span> safe_open(DIR + <span class="hljs-string">&quot;/model.safetensors&quot;</span>, framework=<span class="hljs-string">&quot;pt&quot;</span>, device=<span class="hljs-number">0</span>) <span class="hljs-keyword">as</span> f:
    E = f.get_tensor(<span class="hljs-string">&quot;model.embed_tokens.weight&quot;</span>)  <span class="hljs-comment"># torch.Size([151936, 1024])</span>
    Gamma_finalRMSNorm = f.get_tensor(<span class="hljs-string">&quot;model.norm.weight&quot;</span>)  <span class="hljs-comment"># torch.Size([1024])</span>
    W_output = f.get_tensor(<span class="hljs-string">&quot;lm_head.weight&quot;</span>)  <span class="hljs-comment"># torch.Size([151936, 1024])</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_hidden_layers):
        Gamma_inputRMSNorm.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.input_layernorm.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024])</span>
        Gamma_postATTNRMSNorm.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.post_attention_layernorm.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024])</span>
        W_FFNGate.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.mlp.gate_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([3072, 1024])</span>
        W_FFNUp.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.mlp.up_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([3072, 1024])</span>
        W_FFNDown.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.mlp.down_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024, 3072])</span>
        Gamma_QRMSNorm.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.q_norm.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([128])</span>
        Gamma_KRMSNorm.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.k_norm.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([128])</span>
        W_Q.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.q_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([2048, 1024])</span>
        W_K.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.k_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024, 1024])</span>
        W_V.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.v_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024, 1024])</span>
        W_O.append(f.get_tensor(<span class="hljs-string">f&quot;model.layers.<span class="hljs-subst">{i}</span>.self_attn.o_proj.weight&quot;</span>))  <span class="hljs-comment"># torch.Size([1024, 2048])</span>

model_dtype = E.dtype
</code></pre><h2><a id="toc-2ac" class="anchor" href="#toc-2ac"></a>工具函数</h2><p>主要是RMSNorm、RoPE、SiLU、softmax、masked_softmax等工具函数的实现。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">def</span> <span class="hljs-title function_">RMSNorm</span>(<span class="hljs-params">X, gamma</span>):
    <span class="hljs-keyword">return</span> X / torch.sqrt(torch.mean(X[..., :] ** <span class="hljs-number">2</span>, -<span class="hljs-number">1</span>, keepdim=<span class="hljs-literal">True</span>) + rms_norm_eps) * gamma

<span class="hljs-comment"># interleaved: 交错配对theta[0,0,1,1,2,2,3,3]</span>
<span class="hljs-comment"># rope_theta_repeat2 = torch.pow(rope_theta, -torch.arange(head_dim // 2) * 2 / head_dim).repeat_interleave(2)</span>
<span class="hljs-comment"># rotate_half: 前后两半配对theta_0,1,2,3,0,1,2,3</span>
rope_theta_repeat2 = torch.<span class="hljs-built_in">pow</span>(rope_theta, -torch.arange(head_dim // <span class="hljs-number">2</span>) * <span class="hljs-number">2</span> / head_dim).repeat(<span class="hljs-number">2</span>)
rope_m_theta = torch.arange(max_position_embeddings).reshape(-<span class="hljs-number">1</span>, <span class="hljs-number">1</span>) * rope_theta_repeat2.reshape(<span class="hljs-number">1</span>, -<span class="hljs-number">1</span>)
rope_sin_m_theta = torch.sin(rope_m_theta).cuda()  <span class="hljs-comment"># torch.Size([40960, 128])</span>
rope_cos_m_theta = torch.cos(rope_m_theta).cuda()  <span class="hljs-comment"># torch.Size([40960, 128])</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">RoPE</span>(<span class="hljs-params">X, offset=<span class="hljs-number">0</span></span>):
    Ls = X.shape[-<span class="hljs-number">2</span>]
    d = X.shape[-<span class="hljs-number">1</span>]
    cos, sin = rope_cos_m_theta[offset : offset + Ls], rope_sin_m_theta[offset : offset + Ls]
    <span class="hljs-comment"># interleaved: 交错配对x[-1,0,-3,2]</span>
    <span class="hljs-comment"># X_rot = torch.stack((-X[..., 1::2], X[..., 0::2]), dim=-1).flatten(-2)</span>
    <span class="hljs-comment"># rotate_half: 前后两半配对x[-0,-1,-2,-3,0,1,2,3]</span>
    X_rot = torch.cat((-X[..., d // <span class="hljs-number">2</span> :], X[..., : d // <span class="hljs-number">2</span>]), dim=-<span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> (X * cos + X_rot * sin).to(model_dtype)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">SiLU</span>(<span class="hljs-params">X</span>):
    <span class="hljs-keyword">return</span> X / (<span class="hljs-number">1</span> + torch.exp(-X))

<span class="hljs-keyword">def</span> <span class="hljs-title function_">softmax</span>(<span class="hljs-params">X, temperature=<span class="hljs-number">1</span></span>):
    X_shifted = X - torch.<span class="hljs-built_in">max</span>(X / temperature, dim=-<span class="hljs-number">1</span>, keepdims=<span class="hljs-literal">True</span>).values
    exp_X = torch.exp(X_shifted)
    <span class="hljs-keyword">return</span> exp_X / torch.<span class="hljs-built_in">sum</span>(exp_X, dim=-<span class="hljs-number">1</span>, keepdims=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># 右上方三角被mask</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">masked_softmax</span>(<span class="hljs-params">X</span>):
    <span class="hljs-comment"># X: (batch_size, num_heads, num_steps, num_steps)</span>
    maxlen = X.size(-<span class="hljs-number">1</span>)
    mask = (torch.arange(maxlen).reshape(-<span class="hljs-number">1</span>, <span class="hljs-number">1</span>) &gt;= torch.arange(maxlen)).to(X.device)
    mask_not = ~mask
    <span class="hljs-keyword">return</span> softmax(X * mask + (mask_not * -<span class="hljs-number">1e6</span>).to(X.dtype))
</code></pre><h2><a id="toc-c6e" class="anchor" href="#toc-c6e"></a>核心计算函数与Transformer层</h2><p>主要是FFN、缩放点积注意力、KVCache、单个Transformer层的计算逻辑。</p>
<p>由于投影矩阵是所有注意力头合在一起存放的，<code>transpose_qkv</code>/<code>transpose_output</code>主要用于在计算时的注意力头拆分与恢复。</p>
<p>KVCache主要存储经过投影、RMSNorm、RoPE的K，以及经过投影的V（V不需要RMSNorm、RoPE）。在prefill阶段一次性存储，在predict阶段每个token预测过程中一个个附加存储上去。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">def</span> <span class="hljs-title function_">FFN</span>(<span class="hljs-params">X, gate, up, down</span>):
    <span class="hljs-keyword">return</span> (SiLU(X @ gate.T) * (X @ up.T)) @ down.T

<span class="hljs-comment"># 通过转置实现Q/K/V张量按注意力头的拆分与恢复，便于一次性计算所有注意力头</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">transpose_qkv</span>(<span class="hljs-params">X, num_heads</span>):
    <span class="hljs-comment"># X_h: (batch_size, num_steps, num_heads, num_hiddens/num_heads)</span>
    X_h = X.reshape(*X.shape[:-<span class="hljs-number">1</span>], num_heads, -<span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> X_h.transpose(-<span class="hljs-number">2</span>, -<span class="hljs-number">3</span>)
<span class="hljs-keyword">def</span> <span class="hljs-title function_">transpose_output</span>(<span class="hljs-params">X</span>):
    <span class="hljs-comment"># X_t: (batch_size, num_steps, num_heads, num_hiddens/num_heads)</span>
    X_t = X.transpose(-<span class="hljs-number">2</span>, -<span class="hljs-number">3</span>)
    <span class="hljs-keyword">return</span> X_t.reshape(*X_t.shape[:-<span class="hljs-number">2</span>], -<span class="hljs-number">1</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">DotProductAttention</span>(<span class="hljs-params">Q, K, V, offset=<span class="hljs-number">0</span></span>):
    KVScale = num_attention_heads // num_key_value_heads
    <span class="hljs-comment"># Q/K/V: (batch_size, num_heads, num_steps, num_hiddens/num_heads)</span>
    <span class="hljs-comment"># scores/A: (batch_size, num_heads, num_steps, num_steps)</span>
    scores = Q @ torch.repeat_interleave(K.transpose(-<span class="hljs-number">1</span>, -<span class="hljs-number">2</span>), KVScale, -<span class="hljs-number">3</span>) / torch.sqrt(torch.tensor(Q.shape[-<span class="hljs-number">1</span>]))
    A = softmax(scores) <span class="hljs-keyword">if</span> offset <span class="hljs-keyword">else</span> masked_softmax(scores)
    <span class="hljs-keyword">return</span> A @ torch.repeat_interleave(V, KVScale, -<span class="hljs-number">3</span>)

KVCache: <span class="hljs-built_in">list</span>[<span class="hljs-built_in">list</span>[torch.Tensor]]

<span class="hljs-keyword">def</span> <span class="hljs-title function_">ClearKVCache</span>():
    <span class="hljs-keyword">global</span> KVCache
    KVCache = [<span class="hljs-literal">None</span>] * num_hidden_layers

<span class="hljs-comment"># KVCache中已经prefill或predict了多少个字符</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">GetOffset</span>():
    <span class="hljs-keyword">global</span> KVCache
    <span class="hljs-keyword">return</span> KVCache[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>].size(-<span class="hljs-number">2</span>)

<span class="hljs-comment"># offset为0代表prefill阶段</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">TransfomerLayer</span>(<span class="hljs-params">layer, X, Gamma_inputRMSNorm, Gamma_postATTNRMSNorm, W_FFNGate, W_FFNUp, W_FFNDown, Gamma_QRMSNorm, Gamma_KRMSNorm, W_Q, W_K, W_V, W_O, offset=<span class="hljs-number">0</span></span>):
    <span class="hljs-comment"># X: (batch_size, num_steps, num_hiddens)</span>
    X_inputRMSNorm = RMSNorm(X, Gamma_inputRMSNorm)
    <span class="hljs-comment"># 投影 -&gt; QK RMSNorm -&gt; RoPE -&gt; attention</span>
    <span class="hljs-comment"># Q/K/V: (batch_size, num_steps, num_heads, num_hiddens) -&gt; (batch_size, num_heads, num_steps, num_hiddens/num_heads)</span>
    Q = transpose_qkv(X_inputRMSNorm @ W_Q.T, num_attention_heads)
    K = transpose_qkv(X_inputRMSNorm @ W_K.T, num_key_value_heads)
    V = transpose_qkv(X_inputRMSNorm @ W_V.T, num_key_value_heads)
    Q_RMSNorm = RMSNorm(Q, Gamma_QRMSNorm)
    K_RMSNorm = RMSNorm(K, Gamma_KRMSNorm)
    Q_RoPE = RoPE(Q_RMSNorm, offset)
    K_RoPE = RoPE(K_RMSNorm, offset)
    <span class="hljs-comment"># prefill阶段初始化KVCache</span>
    <span class="hljs-keyword">global</span> KVCache
    <span class="hljs-keyword">if</span> offset == <span class="hljs-number">0</span>:
        KVCache[layer] = [K_RoPE, V]
    <span class="hljs-keyword">else</span>:
        KVCache[layer][<span class="hljs-number">0</span>] = torch.cat((KVCache[layer][<span class="hljs-number">0</span>], K_RoPE), dim=-<span class="hljs-number">2</span>)
        KVCache[layer][<span class="hljs-number">1</span>] = torch.cat((KVCache[layer][<span class="hljs-number">1</span>], V), dim=-<span class="hljs-number">2</span>)
    <span class="hljs-comment"># V_attn: (batch_size, num_heads, num_steps, num_hiddens/num_heads)</span>
    V_attn = DotProductAttention(Q_RoPE, KVCache[layer][<span class="hljs-number">0</span>], KVCache[layer][<span class="hljs-number">1</span>], offset)
    X2 = X + transpose_output(V_attn) @ W_O.T
    <span class="hljs-comment"># FFN前的RMSNorm -&gt; FFN</span>
    <span class="hljs-comment"># O: (batch_size, num_steps, num_hiddens)</span>
    O = X2 + FFN(RMSNorm(X2, Gamma_postATTNRMSNorm), W_FFNGate, W_FFNUp, W_FFNDown)
    <span class="hljs-keyword">return</span> O
</code></pre><h2><a id="toc-651" class="anchor" href="#toc-651"></a>prefill与predict</h2><p>由于prefill阶段不需要output，所以这里把Transformer层后面的输出逻辑单独摘出来为<code>lastOutputToken</code>函数，<code>prefill</code>不需要调用，<code>predict</code>需要调用。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">def</span> <span class="hljs-title function_">prefill</span>(<span class="hljs-params">X</span>):
    ClearKVCache()
    <span class="hljs-comment"># X: (batch_size, num_steps)</span>
    <span class="hljs-comment"># O: (batch_size, num_steps, num_hiddens)</span>
    O = E[X]
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_hidden_layers):
        O = TransfomerLayer(
            i, O, Gamma_inputRMSNorm[i], Gamma_postATTNRMSNorm[i], W_FFNGate[i], W_FFNUp[i], W_FFNDown[i], Gamma_QRMSNorm[i], Gamma_KRMSNorm[i], W_Q[i], W_K[i], W_V[i], W_O[i]
        )
    <span class="hljs-keyword">return</span> O

<span class="hljs-comment"># 多层Transformer得到的结果经过最终的RMSNorm、线性层和softmax得到概率</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">lastOutputToken</span>(<span class="hljs-params">O, temperature=<span class="hljs-number">1</span></span>):
    O = RMSNorm(O, Gamma_finalRMSNorm)
    Y = O @ W_output.T
    P = softmax(Y, temperature)
    <span class="hljs-keyword">return</span> torch.argmax(P, dim=-<span class="hljs-number">1</span>)[..., -<span class="hljs-number">1</span>:].to(torch.long)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">predict</span>(<span class="hljs-params">X, temperature=<span class="hljs-number">1</span></span>):
    offset = GetOffset()
    <span class="hljs-comment"># O: (batch_size, 1)</span>
    res = X.clone().cpu()
    <span class="hljs-keyword">while</span> offset &lt; max_position_embeddings:
        token_id = res[<span class="hljs-number">0</span>][-<span class="hljs-number">1</span>].numpy()
        <span class="hljs-built_in">print</span>(tokenizer.decode([token_id], skip_special_tokens=<span class="hljs-literal">False</span>), end=<span class="hljs-string">&quot;&quot;</span>)
        <span class="hljs-keyword">if</span> token_id == eos_token_id:
            <span class="hljs-keyword">break</span>
        O = E[X]
        <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_hidden_layers):
            O = TransfomerLayer(
                i, O, Gamma_inputRMSNorm[i], Gamma_postATTNRMSNorm[i], W_FFNGate[i], W_FFNUp[i], W_FFNDown[i], Gamma_QRMSNorm[i], Gamma_KRMSNorm[i], W_Q[i], W_K[i], W_V[i], W_O[i], offset
            )
        X = lastOutputToken(O, temperature)
        res = torch.cat((res, X.cpu()), dim=-<span class="hljs-number">1</span>)
        offset += <span class="hljs-number">1</span>
    <span class="hljs-built_in">print</span>()
    <span class="hljs-keyword">return</span> res.numpy()
</code></pre><h2><a id="toc-64d" class="anchor" href="#toc-64d"></a>构造输入</h2><p>解析<code>tokenizer_config.json</code>文件中的template（jinja2格式），将给定测试messages转为用于模型输入的文本，并通过<code>tokenizer.encode</code>得到token id序列。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> jinja2

<span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(DIR + <span class="hljs-string">&quot;/tokenizer_config.json&quot;</span>, <span class="hljs-string">&quot;r&quot;</span>, encoding=<span class="hljs-string">&quot;utf-8&quot;</span>) <span class="hljs-keyword">as</span> f:
    data = json.load(f)
    chat_template = data[<span class="hljs-string">&quot;chat_template&quot;</span>]

tpl = jinja2.Environment().from_string(chat_template)

messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;You are a helpful assistant.&quot;</span>}, {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;steam现在最火的游戏是什么&quot;</span>}]

rendered = tpl.render(
    messages=messages,
    add_generation_prompt=<span class="hljs-literal">True</span>,
    enable_thinking=<span class="hljs-literal">True</span>,
)
tokens = tokenizer.encode(rendered).ids
</code></pre><h2><a id="toc-4ba" class="anchor" href="#toc-4ba"></a>发起预测</h2><p>先完成prefill，将最后一个时间步的Transformer结果，计算最后的token输出逻辑，将其作为predict的第一个输入，循环预测。</p>
<p>同时在整个过程中监测prefill阶段耗时以及predict阶段每秒输出的token数。</p>
<p>由于整个实现是支持多样本的，因此可以同时跑多条prefill和predict。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> time

batch_size = <span class="hljs-number">50</span>

start = time.perf_counter()
O = prefill(torch.tensor(tokens, dtype=torch.long).reshape(<span class="hljs-number">1</span>, -<span class="hljs-number">1</span>).repeat(batch_size, <span class="hljs-number">1</span>))
end = time.perf_counter()
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;prefill耗时: <span class="hljs-subst">{end - start:<span class="hljs-number">.2</span>f}</span> 秒&quot;</span>)

start = time.perf_counter()
X = lastOutputToken(O)
res = predict(X)
end = time.perf_counter()
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;predict: <span class="hljs-subst">{<span class="hljs-built_in">len</span>(res[<span class="hljs-number">0</span>])*batch_size/(end - start):<span class="hljs-number">.2</span>f}</span> tokens/s&quot;</span>)
<span class="hljs-built_in">print</span>(res)
</code></pre><h1><a id="toc-c33" class="anchor" href="#toc-c33"></a>性能</h1><p>由于整体的实现在优化上做得很少，在我3070Ti(8GB)上，能够实现约22 tokens/s的推理速度，在并行50个batch的情况下，能够实现925 tokens/s的推理速度。</p>
<p>这个性能与vLLM/SGLang应该没有数量级上的差距，但是在显存占用上差距比较大。在并行50个batch的情况下，8G显存已经快要打满。核心原因是各类中间张量过多，可以通过算子简化或者inplace运算来降低显存占用。</p>
<h1><a id="toc-e1f" class="anchor" href="#toc-e1f"></a>在过程中遇到的问题</h1><p>在debug的过程中主要有这么几类问题：</p>
<ul>
<li>device的处理：权重和计算过程中的数据一开始就是默认在GPU上的，但是一些arange的数据默认在CPU上，需要手动指定</li>
<li>dtype数据类型的问题：模型权重是bfloat16，而pytorch默认是float32，新创建的（不是与已有张量计算产生的）张量需要指定dtype</li>
<li>RoPE计算问题：这个下面单独讲</li>
</ul>
<p>整体来讲最大的bug在RoPE这里，因为我之前看的Transformer原始实现用的是三角函数位置编码，RoPE不太熟悉，找的资料与模型真实实现其实有差异。反倒是Transformer的实现由于理论方面了解得特别清楚，写完就bug free了。</p>
<h2><a id="toc-7e7" class="anchor" href="#toc-7e7"></a>RoPE的细节</h2><p>第一个要注意的是RoPE的theta的底（<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.76ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 778 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\Theta=\left\{ \theta_i=10000^{-2(i-1)/d}, i \in [1,2,...,d/2] \right\}"><g data-mml-node="mi" data-latex="\Theta"><path data-c="398" d="M388-22C484-22 564 15 628 88C690 158 721 242 721 339C721 436 690 521 629 592C564 667 484 705 388 705C292 705 212 667 148 592C87 521 56 436 56 339C56 242 87 159 148 88C213 15 293-22 388-22M538 601C591 544 617 457 617 339C617 244 599 169 563 114C517 44 459 9 389 9C336 9 286 33 239 80C186 135 160 221 160 339C160 460 186 547 239 602C286 651 335 675 388 675C442 675 492 650 538 601M536 267L569 267L569 417L536 417L536 384L241 384L241 417L208 417L208 267L241 267L241 300L536 300Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.075ex;" xmlns="http://www.w3.org/2000/svg" width="39.808ex" height="3.281ex" role="img" focusable="false" viewBox="0 -975 17595.2 1450"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\Theta=\left\{ \theta_i=10000^{-2(i-1)/d}, i \in [1,2,...,d/2] \right\}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mrow" data-latex="\left\{ \theta_i=10000^{-2(i-1)/d}, i \in [1,2,...,d/2] \right\}" transform="translate(1055.8,0)"><g data-mml-node="mo" data-latex="\left\{"><path data-c="7B" d="M196 250C270 279 353 341 353 431L353 790C353 865 436 925 507 935C518 937 524 944 524 955C524 968 517 975 504 975L502 975C447 966 398 947 353 918C298 881 271 839 271 790L271 431C271 347 192 281 117 270C106 268 100 261 100 250C100 239 106 232 117 230C160 223 196 204 226 172C256 140 271 105 271 69L271-290C271-339 298-381 353-418C398-447 447-466 502-475L504-475C517-475 524-468 524-455C524-444 518-437 507-435C436-425 353-365 353-290L353 69C353 159 270 221 196 250Z"/></g><g data-mml-node="msub" data-latex="\theta_i" transform="translate(624,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(1697.7,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="10000^{-2(i-1)/d}" transform="translate(2753.5,0)"><g data-mml-node="mn" data-latex="10000"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1000,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(2000,0)"/></g><g data-mml-node="TeXAtom" transform="translate(2533,393.1) scale(0.707)" data-latex="{-2(i-1)/d}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(778,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1278,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(1667,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(2012,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2790,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(3290,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(3679,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(4179,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(8659.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(9103.9,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="\in" transform="translate(9726.6,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="mo" data-latex="[" transform="translate(10671.4,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(10949.4,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(11449.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(11894.1,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(12394.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(12838.8,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(13116.8,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(13394.8,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(13672.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(14117.4,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(14637.4,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(15137.4,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mo" data-latex="]" transform="translate(15637.4,0)"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="mo" data-latex="\right\}" transform="translate(15915.4,0)"><path data-c="7D" d="M427 250C354 221 271 159 271 69L271-290C271-366 188-425 116-435C105-437 100-444 100-455C100-468 107-475 120-475L122-475C177-466 226-447 271-418C326-381 353-339 353-290L353 69C353 152 431 219 507 230C518 232 524 239 524 250C524 261 518 268 507 270C431 281 353 348 353 431L353 790C353 839 326 881 271 918C226 947 177 966 122 975L120 975C107 975 100 968 100 955C100 944 105 937 116 935C188 925 271 866 271 790L271 431C271 341 354 279 427 250Z"/></g></g></g></g></svg></mjx-container></span>），要从<code>config.json</code>拿，并不都是10000。</p>
<p>第二个要注意的点是：RoPE有interleaved和rotate_half两种效果等价的变换方式，但是推理时必须采用与训练时一样的变换方式。</p>
<p>interleaved的计算公式：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -10.67ex;" xmlns="http://www.w3.org/2000/svg" width="63.84ex" height="22.47ex" role="img" focusable="false" viewBox="0 -5216 28217.1 9931.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="R_{\Theta,m}^{d}\boldsymbol{x}
=
\begin{pmatrix}
x_0 \\
x_1 \\
x_2 \\
x_3 \\
\vdots \\
x_{d-2} \\
x_{d-1}
\end{pmatrix}
\otimes
\begin{pmatrix}
\cos m\theta_0 \\
\cos m\theta_0 \\
\cos m\theta_1 \\
\cos m\theta_1 \\
\vdots \\
\cos m\theta_{\frac d2-1} \\
\cos m\theta_{\frac d2-1}
\end{pmatrix}
+
\begin{pmatrix}
-x_1 \\
x_0 \\
-x_3 \\
x_2 \\
\vdots \\
-x_{d-1} \\
x_{d-2}
\end{pmatrix}
\otimes
\begin{pmatrix}
\sin m\theta_0 \\
\sin m\theta_0 \\
\sin m\theta_1 \\
\sin m\theta_1 \\
\vdots \\
\sin m\theta_{\frac d2-1} \\
\sin m\theta_{\frac d2-1}
\end{pmatrix}"><g data-mml-node="msubsup" data-latex="R_{\Theta,m}^{d}"><g data-mml-node="mi" data-latex="R"><path data-c="1D445" d="M739 531C739 582 713 621 662 649C621 672 572 683 517 683L235 683C212 683 202 682 202 659C202 652 205 647 211 646C221 645 229 644 234 644C264 643 281 641 286 640C291 639 294 636 294 631C294 629 293 623 290 613L158 82C153 60 143 46 128 41C121 39 103 38 72 38C50 38 41 37 41 15C41 4 47-1 59 0L183 3L309 0C325-1 333 8 333 23C333 33 322 38 301 38C261 38 241 43 241 52C241 52 242 54 244 68L308 327L423 327C492 327 527 298 527 241C527 232 522 210 513 174C502 132 497 104 497 89C497 13 556-22 632-22C660-22 687-9 714 16C741 41 755 68 755 96C755 106 750 111 739 111C732 111 726 106 723 95C712 64 698 41 682 28C666 15 651 8 636 8C613 8 601 27 601 64C601 88 604 125 611 176C614 197 615 212 615 223C615 276 587 315 531 339C625 362 739 429 739 531M609 616C629 603 639 581 639 550C639 530 635 507 626 480C599 398 531 357 422 357L316 357L379 610C384 631 392 642 403 643C408 644 428 644 463 644C528 644 566 642 609 616Z"/></g><g data-mml-node="TeXAtom" transform="translate(792,413) scale(0.707)" data-latex="{d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(792,-273.3) scale(0.707)" data-latex="{\Theta,m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Theta"><path data-c="398" d="M388-22C484-22 564 15 628 88C690 158 721 242 721 339C721 436 690 521 629 592C564 667 484 705 388 705C292 705 212 667 148 592C87 521 56 436 56 339C56 242 87 159 148 88C213 15 293-22 388-22M538 601C591 544 617 457 617 339C617 244 599 169 563 114C517 44 459 9 389 9C336 9 286 33 239 80C186 135 160 221 160 339C160 460 186 547 239 602C286 651 335 675 388 675C442 675 492 650 538 601M536 267L569 267L569 417L536 417L536 384L241 384L241 417L208 417L208 267L241 267L241 300L536 300Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(778,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(1056,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g><g data-mml-node="mi" data-latex="\boldsymbol{x}" transform="translate(2209.5,0)"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3146.3,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(4202.1,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,3455)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-4450)"/><svg width="875" height="6550" y="-3025" x="0" viewBox="0 1637.5 875 6550" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,19.729)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4200)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="msub" data-latex="x_0"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,2800)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="msub" data-latex="x_1"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,1400)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="msub" data-latex="x_2"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,0)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="msub" data-latex="x_3"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-1400)"><g data-mml-node="mtd" transform="translate(854.2,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-2800)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="x_{d-2}"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{d-2}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(520,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1298,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-4200)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="x_{d-1}"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{d-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(520,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1298,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(2801.4,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,3455)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-4450)"/><svg width="875" height="6550" y="-3025" x="0" viewBox="0 1637.5 875 6550" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,19.729)"/></svg></g></g><g data-mml-node="mo" data-latex="\otimes" transform="translate(8100.7,0)"><path data-c="2297" d="M48 249C48 60 201-93 390-93C579-93 732 60 732 249C732 438 579 591 390 591C201 591 48 438 48 249M615 58L423 250L614 441C658 389 685 322 685 249C685 176 659 110 615 58M198 475C250 519 316 545 389 545C462 545 528 519 580 475L389 284M581 24C529-20 462-47 389-47C316-47 249-20 197 24L389 216M164 441L355 250L163 58C119 110 93 176 93 249C93 322 120 389 164 441Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(9104.9,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,3721)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-4716)"/><svg width="875" height="7081.9" y="-3291" x="0" viewBox="0 1770.5 875 7081.9" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,21.331)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4466)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,3066)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,1666)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,266)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-1134)"><g data-mml-node="mtd" transform="translate(2095.7,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-2534)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{\frac d2-1}" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-272) scale(0.707)" data-latex="{\frac d2-1}" data-mjx-texclass="ORD"><g data-mml-node="mfrac" data-latex="\frac d2"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mn" transform="translate(227.1,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="567.7" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="-" transform="translate(807.7,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1585.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-4200)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{\frac d2-1}" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-272) scale(0.707)" data-latex="{\frac d2-1}" data-mjx-texclass="ORD"><g data-mml-node="mfrac" data-latex="\frac d2"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mn" transform="translate(227.1,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="567.7" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="-" transform="translate(807.7,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1585.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(5284.5,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,3721)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-4716)"/><svg width="875" height="7081.9" y="-3291" x="0" viewBox="0 1770.5 875 7081.9" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,21.331)"/></svg></g></g><g data-mml-node="mo" data-latex="+" transform="translate(15486.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(16486.8,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,3455)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-4450)"/><svg width="875" height="6550" y="-3025" x="0" viewBox="0 1637.5 875 6550" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,19.729)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4200)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(778,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,2800)"><g data-mml-node="mtd" transform="translate(847.9,0)"><g data-mml-node="msub" data-latex="x_0"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,1400)"><g data-mml-node="mtd" transform="translate(458.9,0)"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(778,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,0)"><g data-mml-node="mtd" transform="translate(847.9,0)"><g data-mml-node="msub" data-latex="x_2"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-1400)"><g data-mml-node="mtd" transform="translate(1243.2,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-2800)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_{d-1}" transform="translate(778,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{d-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(520,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1298,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-4200)"><g data-mml-node="mtd" transform="translate(389,0)"><g data-mml-node="msub" data-latex="x_{d-2}"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{d-2}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(520,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1298,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(3579.4,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,3455)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-4450)"/><svg width="875" height="6550" y="-3025" x="0" viewBox="0 1637.5 875 6550" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,19.729)"/></svg></g></g><g data-mml-node="mo" data-latex="\otimes" transform="translate(21163.4,0)"><path data-c="2297" d="M48 249C48 60 201-93 390-93C579-93 732 60 732 249C732 438 579 591 390 591C201 591 48 438 48 249M615 58L423 250L614 441C658 389 685 322 685 249C685 176 659 110 615 58M198 475C250 519 316 545 389 545C462 545 528 519 580 475L389 284M581 24C529-20 462-47 389-47C316-47 249-20 197 24L389 216M164 441L355 250L163 58C119 110 93 176 93 249C93 322 120 389 164 441Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(22167.7,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,3721)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-4716)"/><svg width="875" height="7081.9" y="-3291" x="0" viewBox="0 1770.5 875 7081.9" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,21.331)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4466)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,3066)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,1666)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,266)"><g data-mml-node="mtd" transform="translate(560.6,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-1134)"><g data-mml-node="mtd" transform="translate(2040.7,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-2534)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{\frac d2-1}" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-272) scale(0.707)" data-latex="{\frac d2-1}" data-mjx-texclass="ORD"><g data-mml-node="mfrac" data-latex="\frac d2"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mn" transform="translate(227.1,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="567.7" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="-" transform="translate(807.7,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1585.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-4200)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{\frac d2-1}" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-272) scale(0.707)" data-latex="{\frac d2-1}" data-mjx-texclass="ORD"><g data-mml-node="mfrac" data-latex="\frac d2"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mn" transform="translate(227.1,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="567.7" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="-" transform="translate(807.7,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1585.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(5174.5,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,3721)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-4716)"/><svg width="875" height="7081.9" y="-3291" x="0" viewBox="0 1770.5 875 7081.9" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,21.331)"/></svg></g></g></g></g></svg></mjx-container></span></p>
<p>rotate_half的计算公式：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -11.678ex;" xmlns="http://www.w3.org/2000/svg" width="62.494ex" height="24.487ex" role="img" focusable="false" viewBox="0 -5661.6 27622.4 10823.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="R_{\Theta,m}^{\text{lh},d}\boldsymbol x
=
\begin{pmatrix}
\boldsymbol x_\text{top} \\
\boldsymbol x_\text{bot}
\end{pmatrix}
\otimes
\begin{pmatrix}
\cos m\theta_0 \\
\cos m\theta_1 \\
\vdots \\
\cos m\theta_{d_h-1} \\
\cos m\theta_0 \\
\cos m\theta_1 \\
\vdots \\
\cos m\theta_{d_h-1}
\end{pmatrix}
+
\begin{pmatrix}
-\boldsymbol x_\text{bot} \\
\boldsymbol x_\text{top}
\end{pmatrix}
\otimes
\begin{pmatrix}
\sin m\theta_0 \\
\sin m\theta_1 \\
\vdots \\
\sin m\theta_{d_h-1} \\
\sin m\theta_0 \\
\sin m\theta_1 \\
\vdots \\
\sin m\theta_{d_h-1}
\end{pmatrix}"><g data-mml-node="msubsup" data-latex="R_{\Theta,m}^{\text{lh},d}"><g data-mml-node="mi" data-latex="R"><path data-c="1D445" d="M739 531C739 582 713 621 662 649C621 672 572 683 517 683L235 683C212 683 202 682 202 659C202 652 205 647 211 646C221 645 229 644 234 644C264 643 281 641 286 640C291 639 294 636 294 631C294 629 293 623 290 613L158 82C153 60 143 46 128 41C121 39 103 38 72 38C50 38 41 37 41 15C41 4 47-1 59 0L183 3L309 0C325-1 333 8 333 23C333 33 322 38 301 38C261 38 241 43 241 52C241 52 242 54 244 68L308 327L423 327C492 327 527 298 527 241C527 232 522 210 513 174C502 132 497 104 497 89C497 13 556-22 632-22C660-22 687-9 714 16C741 41 755 68 755 96C755 106 750 111 739 111C732 111 726 106 723 95C712 64 698 41 682 28C666 15 651 8 636 8C613 8 601 27 601 64C601 88 604 125 611 176C614 197 615 212 615 223C615 276 587 315 531 339C625 362 739 429 739 531M609 616C629 603 639 581 639 550C639 530 635 507 626 480C599 398 531 357 422 357L316 357L379 610C384 631 392 642 403 643C408 644 428 644 463 644C528 644 566 642 609 616Z"/></g><g data-mml-node="TeXAtom" transform="translate(792,490.1) scale(0.707)" data-latex="{\text{lh},d}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{lh}"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(278,0)"/></g><g data-mml-node="mo" data-latex="," transform="translate(834,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1112,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(792,-324.9) scale(0.707)" data-latex="{\Theta,m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Theta"><path data-c="398" d="M388-22C484-22 564 15 628 88C690 158 721 242 721 339C721 436 690 521 629 592C564 667 484 705 388 705C292 705 212 667 148 592C87 521 56 436 56 339C56 242 87 159 148 88C213 15 293-22 388-22M538 601C591 544 617 457 617 339C617 244 599 169 563 114C517 44 459 9 389 9C336 9 286 33 239 80C186 135 160 221 160 339C160 460 186 547 239 602C286 651 335 675 388 675C442 675 492 650 538 601M536 267L569 267L569 417L536 417L536 384L241 384L241 417L208 417L208 267L241 267L241 300L536 300Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(778,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(1056,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g><g data-mml-node="mi" data-latex="\boldsymbol x" transform="translate(2209.5,0)"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3146.3,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(4202.1,0)"><g data-mml-node="mo"><path data-c="28" d="M660-946C675-946 682-939 682-924C682-917 679-911 674-907C606-856 545-777 490-670C393-480 320-209 320 65L320 435C320 560 335 686 364 813C416 1043 523 1293 674 1407C679 1411 682 1417 682 1424C682 1439 675 1446 660 1446C656 1446 652 1444 647 1441C574 1386 505 1304 440 1195C327 1005 226 718 226 435L226 65C226-202 320-477 422-664C490-787 565-880 647-941C652-944 656-946 660-946Z"/></g><g data-mml-node="mtable" transform="translate(736,0)"><g data-mml-node="mtr" transform="translate(0,718.6)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\boldsymbol x_\text{top}"><g data-mml-node="mi" data-latex="\boldsymbol x"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mtext" transform="translate(692,-150) scale(0.707)" data-latex="\text{top}"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(389,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(889,0)"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-718.6)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\boldsymbol x_\text{bot}"><g data-mml-node="mi" data-latex="\boldsymbol x"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mtext" transform="translate(692,-150) scale(0.707)" data-latex="\text{bot}"><path data-c="62" d="M298-11C360-11 413 11 456 56C499 101 521 154 521 217C521 278 501 332 460 377C419 422 369 445 308 445C259 445 215 426 178 387L178 694L28 683L28 645C64 645 86 642 94 636C102 630 105 616 105 593L105 0L136 0L169 58C201 12 244-11 298-11M294 19C253 19 219 38 194 77C185 90 181 104 181 117L181 320C181 333 184 344 191 354C220 395 257 415 304 415C345 415 378 395 404 354C422 324 431 279 431 218C431 110 393 19 294 19Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(556,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1056,0)"/></g></g></g></g></g><g data-mml-node="mo" transform="translate(2499.8,0)"><path data-c="29" d="M89-941C162-886 231-804 296-695C409-506 510-218 510 65L510 435C510 702 416 977 314 1164C246 1287 171 1380 89 1441C84 1444 80 1446 76 1446C61 1446 54 1439 54 1424C54 1417 57 1411 62 1407C130 1356 191 1277 246 1170C343 980 416 709 416 435L416 65C416-60 401-186 372-313C320-543 213-793 62-907C57-911 54-917 54-924C54-939 61-946 76-946C80-946 84-944 89-941Z"/></g></g><g data-mml-node="mo" data-latex="\otimes" transform="translate(7660.1,0)"><path data-c="2297" d="M48 249C48 60 201-93 390-93C579-93 732 60 732 249C732 438 579 591 390 591C201 591 48 438 48 249M615 58L423 250L614 441C658 389 685 322 685 249C685 176 659 110 615 58M198 475C250 519 316 545 389 545C462 545 528 519 580 475L389 284M581 24C529-20 462-47 389-47C316-47 249-20 197 24L389 216M164 441L355 250L163 58C119 110 93 176 93 249C93 322 120 389 164 441Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(8664.3,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,4166.6)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-5161.6)"/><svg width="875" height="7973.1" y="-3736.6" x="0" viewBox="0 1993.3 875 7973.1" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,24.015)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4911.6)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,3511.6)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,2111.6)"><g data-mml-node="mtd" transform="translate(2167.4,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,711.6)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{d_h-1}" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-150) scale(0.707)" data-latex="{d_h-1}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_h"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(1010.3,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1788.3,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-2100)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-3500)"><g data-mml-node="mtd" transform="translate(2167.4,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-4900)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1504.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{d_h-1}" transform="translate(2382.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-150) scale(0.707)" data-latex="{d_h-1}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_h"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(1010.3,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1788.3,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(5427.7,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,4166.6)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-5161.6)"/><svg width="875" height="7973.1" y="-3736.6" x="0" viewBox="0 1993.3 875 7973.1" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,24.015)"/></svg></g></g><g data-mml-node="mo" data-latex="+" transform="translate(15189.3,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(16189.5,0)"><g data-mml-node="mo"><path data-c="28" d="M660-946C675-946 682-939 682-924C682-917 679-911 674-907C606-856 545-777 490-670C393-480 320-209 320 65L320 435C320 560 335 686 364 813C416 1043 523 1293 674 1407C679 1411 682 1417 682 1424C682 1439 675 1446 660 1446C656 1446 652 1444 647 1441C574 1386 505 1304 440 1195C327 1005 226 718 226 435L226 65C226-202 320-477 422-664C490-787 565-880 647-941C652-944 656-946 660-946Z"/></g><g data-mml-node="mtable" transform="translate(736,0)"><g data-mml-node="mtr" transform="translate(0,718.6)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="\boldsymbol x_\text{bot}" transform="translate(778,0)"><g data-mml-node="mi" data-latex="\boldsymbol x"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mtext" transform="translate(692,-150) scale(0.707)" data-latex="\text{bot}"><path data-c="62" d="M298-11C360-11 413 11 456 56C499 101 521 154 521 217C521 278 501 332 460 377C419 422 369 445 308 445C259 445 215 426 178 387L178 694L28 683L28 645C64 645 86 642 94 636C102 630 105 616 105 593L105 0L136 0L169 58C201 12 244-11 298-11M294 19C253 19 219 38 194 77C185 90 181 104 181 117L181 320C181 333 184 344 191 354C220 395 257 415 304 415C345 415 378 395 404 354C422 324 431 279 431 218C431 110 393 19 294 19Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(556,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1056,0)"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-681.4)"><g data-mml-node="mtd" transform="translate(389,0)"><g data-mml-node="msub" data-latex="\boldsymbol x_\text{top}"><g data-mml-node="mi" data-latex="\boldsymbol x"><path data-c="1D499" d="M604 364C604 417 551 452 490 452C433 452 396 409 383 391C358 433 302 452 245 452C119 452 51 329 51 296C51 282 66 282 75 282C87 282 94 282 98 295C127 386 199 416 240 416C278 416 296 398 296 366C296 347 282 292 273 256L239 119C224 58 188 28 154 28C149 28 126 28 106 43C142 53 160 87 160 112C160 134 143 158 110 158C75 158 38 129 38 80C38 27 91-8 152-8C209-8 246 35 259 53C284 11 340-8 397-8C523-8 591 115 591 148C591 162 576 162 567 162C555 162 548 162 544 149C515 58 443 28 402 28C364 28 346 46 346 78C346 99 359 152 368 189L403 325C418 385 453 416 488 416C493 416 516 416 536 401C500 391 482 357 482 332C482 310 499 286 532 286C567 286 604 315 604 364Z"/></g><g data-mml-node="mtext" transform="translate(692,-150) scale(0.707)" data-latex="\text{top}"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(389,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(889,0)"/></g></g></g></g></g><g data-mml-node="mo" transform="translate(3277.8,0)"><path data-c="29" d="M89-941C162-886 231-804 296-695C409-506 510-218 510 65L510 435C510 702 416 977 314 1164C246 1287 171 1380 89 1441C84 1444 80 1446 76 1446C61 1446 54 1439 54 1424C54 1417 57 1411 62 1407C130 1356 191 1277 246 1170C343 980 416 709 416 435L416 65C416-60 401-186 372-313C320-543 213-793 62-907C57-911 54-917 54-924C54-939 61-946 76-946C80-946 84-944 89-941Z"/></g></g><g data-mml-node="mo" data-latex="\otimes" transform="translate(20425.5,0)"><path data-c="2297" d="M48 249C48 60 201-93 390-93C579-93 732 60 732 249C732 438 579 591 390 591C201 591 48 438 48 249M615 58L423 250L614 441C658 389 685 322 685 249C685 176 659 110 615 58M198 475C250 519 316 545 389 545C462 545 528 519 580 475L389 284M581 24C529-20 462-47 389-47C316-47 249-20 197 24L389 216M164 441L355 250L163 58C119 110 93 176 93 249C93 322 120 389 164 441Z"/></g><g data-mml-node="mrow" data-latex="{pmatrix}" transform="translate(21429.7,0)"><g data-mml-node="mo"><path data-c="239B" d="M813 1450C820 1455 823 1462 823 1470C823 1487 815 1495 798 1495C793 1495 788 1493 784 1490C697 1423 614 1324 536 1192C399 956 277 603 277 253L277 0L385 0L385 253C385 407 403 562 438 719C500 999 630 1313 813 1450Z" transform="translate(0,4166.6)"/><path data-c="239D" d="M798 0C815 0 823 8 823 25C823 34 819 40 812 44C731 106 658 202 592 334C474 569 385 903 385 1242L385 1495L277 1495L277 1242C277 914 388 575 512 345C594 193 685 80 784 5C788 2 793 0 798 0Z" transform="translate(0,-5161.6)"/><svg width="875" height="7973.1" y="-3736.6" x="0" viewBox="0 1993.3 875 7973.1" xmlns="http://www.w3.org/2000/svg"><path data-c="239C" d="M277 0L385 0L385 498L277 498Z" transform="scale(1,24.015)"/></svg></g><g data-mml-node="mtable" transform="translate(875,0)"><g data-mml-node="mtr" transform="translate(0,4911.6)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,3511.6)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,2111.6)"><g data-mml-node="mtd" transform="translate(2112.4,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,711.6)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{d_h-1}" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-150) scale(0.707)" data-latex="{d_h-1}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_h"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(1010.3,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1788.3,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_0" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-2100)"><g data-mml-node="mtd" transform="translate(632.3,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_1" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mn" transform="translate(502,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-3500)"><g data-mml-node="mtd" transform="translate(2112.4,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-4900)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="m" transform="translate(1394.7,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\theta_{d_h-1}" transform="translate(2272.7,0)"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="TeXAtom" transform="translate(502,-150) scale(0.707)" data-latex="{d_h-1}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_h"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(1010.3,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1788.3,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(5317.7,0)"><path data-c="239E" d="M490 0L598 0L598 253C598 581 487 920 363 1150C281 1301 190 1415 91 1490C87 1493 82 1495 77 1495C60 1495 52 1487 52 1470C52 1462 55 1455 62 1450C143 1389 216 1292 283 1160C402 924 490 593 490 253Z" transform="translate(0,4166.6)"/><path data-c="23A0" d="M598 1242L598 1495L490 1495L490 1242C490 1088 472 933 437 776C375 494 246 184 63 44C56 40 52 34 52 25C52 8 60 0 77 0C82 0 87 2 91 5C178 71 261 170 339 303C477 539 598 892 598 1242Z" transform="translate(0,-5161.6)"/><svg width="875" height="7973.1" y="-3736.6" x="0" viewBox="0 1993.3 875 7973.1" xmlns="http://www.w3.org/2000/svg"><path data-c="239F" d="M490 0L598 0L598 498L490 498Z" transform="scale(1,24.015)"/></svg></g></g></g></g></svg></mjx-container></span></p>
<p>整体来讲，工业界更常用rotate_half的方式，因为它可以通过复数来简化计算。Qwen3-0.6B使用的就是该方式。</p>

            ]]></description>
            <pubDate>Fri, 21 Aug 2026 05:44:18 GMT</pubDate>
            <guid>https://fanzheng.org/post/gu-fa-shou-si-jian-yi-LLM-tui-li-qi.html</guid>
        </item>
        <item>
            <title>CUDA nvcc环境配置问题与迷思</title>
            <link>https://fanzheng.org/post/CUDA nvcc-huan-jing-pei-zhi-wen-ti-yu-mi-si.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#toc-e65">安装</a></li><ul><li><a href="#toc-fb4">通过pip安装</a></li><li><a href="#toc-2f1">通过Nvidia私有源安装</a></li></ul><li><a href="#toc-db0">测试</a></li></ul></div><p>主要讲在Linux中怎么配。</p>
<p>以Debian为例，虽然源里也有<a href="https://packages.debian.org/trixie/nvidia-cuda-toolkit">nvidia-cuda-toolkit</a>，但是其版本太低，Debian 13的nvcc居然是24年的，还不支持Debian 13源里的默认的gcc 14。所以安装nvcc主要有如下两种方式。</p>
<h1><a id="toc-e65" class="anchor" href="#toc-e65"></a>安装</h1><h2><a id="toc-fb4" class="anchor" href="#toc-fb4"></a>通过pip安装</h2><p>直接<code>uv pip install nvidia-cuda-nvcc</code>即可，头文件什么都是齐全的，是最简单的方式。</p>
<p>在VSCode中，应当这样配置<code>c_cpp_properties.json</code>（主要是<code>compilerPath</code>），相关的语法和标识符才不会飘红：</p>
<pre><code class="hljs lang-json"><span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;configurations&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
        <span class="hljs-punctuation">{</span>
            <span class="hljs-attr">&quot;name&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Linux&quot;</span><span class="hljs-punctuation">,</span>
            <span class="hljs-attr">&quot;includePath&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
                <span class="hljs-string">&quot;${workspaceFolder}/**&quot;</span>
            <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
            <span class="hljs-attr">&quot;compilerPath&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;/mnt/d/work/python-work/cuda-learn/.venv/lib/python3.14/site-packages/nvidia/cu13/bin/nvcc&quot;</span>
        <span class="hljs-punctuation">}</span>
    <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;version&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">4</span>
<span class="hljs-punctuation">}</span>
</code></pre><p>然后将nvcc的bin路径加到PATH即可。</p>
<h2><a id="toc-2f1" class="anchor" href="#toc-2f1"></a>通过Nvidia私有源安装</h2><p>参考<a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#debian-installation">官方文档</a>的说明，步骤如下：</p>
<pre><code class="hljs lang-bash"><span class="hljs-comment"># wget https://developer.download.nvidia.com/compute/cuda/repos/&lt;distro&gt;/&lt;arch&gt;/cuda-keyring_1.1-1_all.deb</span>
<span class="hljs-comment"># Debian 13 x86_64</span>
wget https://developer.download.nvidia.cn/compute/cuda/repos/debian13/x86_64/cuda-keyring_1.1-1_all.deb
<span class="hljs-built_in">sudo</span> dpkg -i cuda-keyring_1.1-1_all.deb
<span class="hljs-built_in">sudo</span> apt install cuda-toolkit
</code></pre><p>然后把<code>/usr/local/cuda/bin</code>加到PATH里即可。</p>
<p>在VSCode的<code>c_cpp_properties.json</code>中，compilerPath要配置成<code>/usr/local/cuda/bin/nvcc</code>。</p>
<h1><a id="toc-db0" class="anchor" href="#toc-db0"></a>测试</h1><p>可以跑一下向量加的<a href="https://github.com/NVIDIA/cuda-samples/blob/master/cpp/0_Introduction/vectorAdd/vectorAdd.cu">cuda-samples</a>。</p>
<p>编译并运行：</p>
<pre><code class="hljs lang-routeros">nvcc add.cu <span class="hljs-attribute">-arch</span>=sm_86 -o <span class="hljs-built_in">add</span> &amp;&amp; ./add
</code></pre><p>加<code>-arch=sm_86</code>是因为我装的nvcc V13.3.73默认是sm_75的（CUDA 13.X最低支持硬件就是sm_75），而我的3070Ti是sm_86。</p>
<blockquote>
<p><a href="https://docs.nvidia.com/cuda/pdf/CUDA_Tile_Cpp_API_Reference.pdf">CUDA Tile C++ API Reference, Release 13.3</a>文档上有写：<br>Note: NVCC targets sm_75 as the default architecture if no architecture is provided. In this configuration, no tile code will be generated and a tile kernel launch will fail at runtime.</p>
</blockquote>

            ]]></description>
            <pubDate>Thu, 20 Aug 2026 14:24:11 GMT</pubDate>
            <guid>https://fanzheng.org/post/CUDA nvcc-huan-jing-pei-zhi-wen-ti-yu-mi-si.html</guid>
        </item>
        <item>
            <title>《动手学深度学习》学习记录</title>
            <link>https://fanzheng.org/post/d2l-notes.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#toc-7f1">前言、安装与符号</a></li><li><a href="#toc-e45">引言</a></li><li><a href="#toc-81f">预备知识</a></li><ul><li><a href="#toc-524">数据操作</a></li><li><a href="#toc-603">数据预处理</a></li><li><a href="#toc-4d0">线性代数</a></li><li><a href="#toc-8b2">微积分</a></li><li><a href="#toc-bc3">自动微分</a></li><li><a href="#toc-e49">概率</a></li></ul><li><a href="#toc-5e0">线性神经网络</a></li><ul><li><a href="#toc-d8b">线性回归</a></li><li><a href="#toc-b68">softmax回归</a></li></ul><li><a href="#toc-55d">多层感知机</a></li><ul><li><a href="#toc-7b3">多层感知机原理</a></li><li><a href="#toc-e8f">模型选择、欠拟合和过拟合</a></li><li><a href="#toc-6b2">权重衰减</a></li><li><a href="#toc-75e">暂退法（Dropout）</a></li><li><a href="#toc-e82">前向传播、反向传播和计算图</a></li><li><a href="#toc-fd4">数值稳定性和模型初始化</a></li><li><a href="#toc-3c3">环境和分布偏移</a></li><li><a href="#toc-0c8">实战Kaggle比赛：预测房价</a></li></ul><li><a href="#toc-c44">深度学习计算</a></li><ul><li><a href="#toc-4ea">层和块</a></li><li><a href="#toc-cf7">参数管理</a></li><li><a href="#toc-380">延后初始化</a></li><li><a href="#toc-3eb">自定义层</a></li><li><a href="#toc-8d1">读写文件</a></li><li><a href="#gpu">GPU</a></li></ul><li><a href="#toc-112">卷积神经网络</a></li><ul><li><a href="#toc-201">从全连接层到卷积 &amp; 图像卷积</a></li><li><a href="#toc-171">填充和步幅</a></li><li><a href="#toc-a98">多输入多输出通道</a></li><li><a href="#toc-275">汇聚层</a></li><li><a href="#toc-016">卷积神经网络（LeNet）</a></li></ul><li><a href="#toc-6d4">现代卷积神经网络</a></li><ul><li><a href="#toc-16d">深度卷积神经网络（AlexNet）</a></li><li><a href="#toc-d7e">使用块的网络（VGG）</a></li><li><a href="#toc-3ee">网络中的网络（NiN）</a></li><li><a href="#toc-5fb">含并行连结的网络（GoogLeNet）</a></li><li><a href="#toc-3ed">批量规范化</a></li><li><a href="#toc-958">残差网络（ResNet）</a></li><li><a href="#toc-1e0">稠密连接网络（DenseNet）</a></li></ul><li><a href="#toc-aad">循环神经网络</a></li><ul><li><a href="#toc-66c">序列模型</a></li><li><a href="#toc-33f">文本预处理</a></li><li><a href="#toc-a4e">语言模型和数据集</a></li><li><a href="#toc-ad8">循环神经网络实现</a></li><li><a href="#toc-5f6">通过时间反向传播</a></li></ul><li><a href="#toc-db5">现代循环神经网络</a></li><ul><li><a href="#toc-cef">门控循环单元（GRU）</a></li><li><a href="#toc-62c">长短期记忆网络（LSTM）</a></li><li><a href="#toc-fba">深度循环神经网络</a></li><li><a href="#toc-5fe">双向循环神经网络</a></li><li><a href="#toc-d6f">机器翻译与数据集</a></li><li><a href="#toc-4cc">编码器-解码器架构</a></li><li><a href="#toc-c03">序列到序列学习（seq2seq）</a></li><li><a href="#toc-093">束搜索</a></li></ul><li><a href="#toc-7b4">注意力机制</a></li><ul><li><a href="#toc-60f">注意力提示（Queries, Keys, and Values）</a></li><li><a href="#toc-272">注意力汇聚：Nadaraya-Watson核回归（Attention Pooling by Similarity）</a></li><li><a href="#toc-82f">注意力评分函数（Attention Scoring Functions）</a></li><li><a href="#toc-6fa">Bahdanau注意力（The Bahdanau Attention Mechanism）</a></li><li><a href="#toc-593">多头注意力（Multi-Head Attention）</a></li><li><a href="#toc-bac">自注意力和位置编码（Self-Attention and Positional Encoding）</a></li><li><a href="#toc-29c">Transformer（The Transformer Architecture）</a></li><li><a href="#toc-a6c">【TODO】Transformers for Vision（视觉Transformer）</a></li><li><a href="#toc-454">【TODO】Large-Scale Pretraining with Transformers（Transformer的大规模预训练）</a></li></ul><li><a href="#toc-b19">【TODO】优化算法</a></li><li><a href="#toc-738">【TODO】计算性能</a></li></ul></div><p>李沐的<a href="https://zh-v2.d2l.ai/">《动手学深度学习》</a>是一个非常不错的深度学习入门教材。在学习一段时间后，我觉得有必要以笔记的形式记录下我对每个章节的概括以及一些关键问题的认识和理解（在学习过程中产生的但教材没有解答的一些疑问和经过研究与思考后我的理解），也能强化自己对深度学习的理解。</p>
<p>本文的章节组织形式将与D2L中文版教材基本相同。</p>
<!--
<link rel="stylesheet" href="https://unpkg.com/katex@0.16.45/dist/katex.min.css">
<script type="module">
    import mermaid from 'https://unpkg.com/mermaid@11.16.0/dist/mermaid.esm.min.mjs';
    mermaid.initialize({ startOnLoad: true, forceLegacyMathML: true });
</script>
-->
<script type="module">
    import mermaid from 'https://unpkg.com/mermaid@11/dist/mermaid.esm.min.mjs';
    mermaid.initialize({ startOnLoad: true });
</script><h1><a id="toc-7f1" class="anchor" href="#toc-7f1"></a>前言、安装与符号</h1><p><strong>前言</strong>：主要介绍了教材的内容与结构，并使用Jupyter Notebook的形式来组织。</p>
<p><strong>安装</strong>：主要介绍如何配置运行Python、Jupyter Notebook、相关库以及运行本书所需的代码等所需的环境。由于教材及其配套代码的最终更新日期已是23年，所以相关库依赖与当前最新版本存在一些冲突。另外如果是在Windows平台上使用，还涉及到我之前在<a href="https://fanzheng.org/post/myth-of-python-and-pytorch.html">关于python与pytorch的各种配置问题与迷思</a>中提到的一些问题。因此在安装pytorch和d2l库时，建议通过以下方法安装：</p>
<pre><code class="hljs lang-bash">conda create -n d2l python=3.14
conda activate d2l

conda install pytorch torchvision
pip install d2l --no-deps <span class="hljs-comment"># 不直接安装d2l包声明的依赖，而是手动安装依赖</span>
pip install matplotlib pandas requests scipy numpy
</code></pre><p><strong>符号</strong>：介绍了教材中所使用的各类数学符号的含义，包括数值对象、集合论、函数和运算符、微积分、概率统计与信息论等领域。</p>
<h1><a id="toc-e45" class="anchor" href="#toc-e45"></a>引言</h1><p>引入机器学习（深度学习），表达它与“业务逻辑”的关键区别在于：机器学习是一类强大的可以从经验中学习的技术，而业务逻辑执行的一直是相同的任务，无论积累多少经验，都不会自动提高，除非开发人员认识到问题并更新软件。</p>
<p>机器学习的关键组件其实只有4个：<strong>数据</strong>、<strong>模型</strong>、<strong>目标函数</strong>、<strong>优化算法</strong>。</p>
<p>机器学习问题大致可以按如下方式分类：</p>
<ul>
<li>监督学习<ul>
<li>回归</li>
<li>分类</li>
<li>标记问题（多标签分类，学习预测不相互排斥的类别的问题）</li>
<li>搜索</li>
<li>推荐系统</li>
<li>序列学习</li>
</ul>
</li>
<li>无监督学习<ul>
<li>聚类</li>
<li>主成分分析</li>
<li>因果关系和概率图模型</li>
<li>生成对抗性网络</li>
</ul>
</li>
<li>强化学习（会与环境互动）</li>
</ul>
<p>近些年深度学习的发展主要归功于数据、算力的增长以及日益强大的开源infra工具链。</p>
<p>深度学习方法中最显著的共同点是使用端到端训练，通过力大砖飞的思想，取代了传统机器学习管道末端的浅层模型以及劳动密集型的特征工程，实现了一种相对简单、通用、大一统的方法来解决各类机器学习问题。正如<a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html">《苦涩的教训》</a>所表达的观点：利用人类知识构建AI的方法最终都会失效，基于大规模算力和通用搜索/学习算法的方法才是最有效的。</p>
<h1><a id="toc-81f" class="anchor" href="#toc-81f"></a>预备知识</h1><p>对于数学知识来说，我认为重要性和难度排序是（仅针对入门）：概率统计 &gt; 微积分 &gt; 线性代数。</p>
<h2><a id="toc-524" class="anchor" href="#toc-524"></a>数据操作</h2><p>其他内容基本中规中矩，理解广播机制比较重要。python的list相加，其实是拼接操作；而Tensor的相加其实是两个Tensor按元素相加的操作。</p>
<p>当两个Tensor维度不匹配的时候，会从最后一个维度来依次往前匹配，若有一个维度的大小不匹配，就无法相加，除非其中一个维度的大小是1，此时会应用广播机制，将该维度的元素按另一个维度的大小复制相同的份数，再进行计算。例如下面的代码会得到一个全为2的、shape为<code>[4, 6, 3, 3, 6, 7]</code>的Tensor。</p>
<pre><code class="hljs lang-python">t1=torch.ones((    <span class="hljs-number">3</span>,<span class="hljs-number">1</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>))
t2=torch.ones((<span class="hljs-number">4</span>,<span class="hljs-number">6</span>,<span class="hljs-number">1</span>,<span class="hljs-number">3</span>,<span class="hljs-number">1</span>,<span class="hljs-number">1</span>))
<span class="hljs-built_in">print</span>((t1+t2).shape)
</code></pre><h2><a id="toc-603" class="anchor" href="#toc-603"></a>数据预处理</h2><p>介绍了怎么借助pandas来做数据清洗。</p>
<h2><a id="toc-4d0" class="anchor" href="#toc-4d0"></a>线性代数</h2><p>主要介绍如何在pytorch中对标量、向量、矩阵和张量执行各种操作。</p>
<p>除了最基本的操作之外，本节介绍了一个比较重要的操作即通过形如<code>A.sum(axis=1, keepdims=True)</code>的方式进行按某维度求和与非降维求和（便于借助广播机制做下一步计算）。</p>
<h2><a id="toc-8b2" class="anchor" href="#toc-8b2"></a>微积分</h2><p>介绍微积分中的几个关键概念：<strong>导数</strong>、<strong>偏导数</strong>、<strong>梯度</strong>和<strong>链式法则</strong>。</p>
<p>单变量函数可以求<strong>导数</strong>，多变量可以求<strong>偏导数</strong>。连结一个多元函数对其所有变量的偏导数，可以得到该函数的<strong>梯度</strong>向量：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -1.909ex;" xmlns="http://www.w3.org/2000/svg" width="39.397ex" height="5.295ex" role="img" focusable="false" viewBox="0 -1496.6 17413.6 2340.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\nabla_{\mathbf{x}} f(\mathbf{x}) = \bigg[\frac{\partial f(\mathbf{x})}{\partial x_1}, \frac{\partial f(\mathbf{x})}{\partial x_2}, \ldots, \frac{\partial f(\mathbf{x})}{\partial x_n}\bigg]^\top"><g data-mml-node="msub" data-latex="\nabla_{\mathbf{x}}"><g data-mml-node="mi" data-latex="\nabla"><path data-c="2207" d="M780 657C783 664 785 669 785 671C785 679 776 683 759 683L73 683C56 683 47 679 47 670L387-13C394-26 403-33 416-33C429-33 438-26 445-13M445 72L179 605L710 605Z"/></g><g data-mml-node="TeXAtom" transform="translate(866,-150) scale(0.707)" data-latex="{\mathbf{x}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g><g data-mml-node="mi" data-latex="f" transform="translate(1345.2,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1897.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2286.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2893.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3560,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\bigg[" data-mjx-texclass="ORD" transform="translate(4615.8,0)"><g data-mml-node="mo"><path data-c="5B" d="M448-738L290-738L290 1238L448 1238C468 1238 478 1248 478 1269C478 1290 468 1300 448 1300L230 1300L230-800L448-800C468-800 478-790 478-769C478-753 464-738 448-738Z"/></g></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(\mathbf{x})}{\partial x_1}" transform="translate(5114.8,0)"><g data-mml-node="mrow" data-latex="\partial f(\mathbf{x})" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2114,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial x_1" transform="translate(684.2,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><rect width="2703" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="," transform="translate(8057.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(\mathbf{x})}{\partial x_2}" transform="translate(8502.4,0)"><g data-mml-node="mrow" data-latex="\partial f(\mathbf{x})" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2114,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial x_2" transform="translate(684.2,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g><rect width="2703" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="," transform="translate(11445.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(11890.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(12893.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(\mathbf{x})}{\partial x_n}" transform="translate(13338.4,0)"><g data-mml-node="mrow" data-latex="\partial f(\mathbf{x})" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2114,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial x_n" transform="translate(648.9,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_n" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g><rect width="2703" height="60" x="120" y="220"/></g><g data-mml-node="msup" data-latex="\bigg]^\top" transform="translate(16281.4,0)"><g data-mml-node="TeXAtom" data-latex="\bigg]" data-mjx-texclass="ORD"><g data-mml-node="mo"><path data-c="5D" d="M51-800L269-800L269 1300L51 1300C31 1300 21 1290 21 1269C21 1248 31 1238 51 1238L209 1238L209-738L51-738C31-738 21-748 21-769C21-790 31-800 51-800Z"/></g></g><g data-mml-node="mi" transform="translate(532,1027.1) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>所以<strong>梯度</strong>是一个向量，每个分量是函数对某个变量的偏导数。多元函数的<strong>全微分</strong><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="2.507ex" height="2.059ex" role="img" focusable="false" viewBox="0 -705 1108 910"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathrm{d}f"><g data-mml-node="TeXAtom" data-latex="\mathrm{d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/></g></g><g data-mml-node="mi" data-latex="f" transform="translate(556,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg></mjx-container></span>可以看作是梯度向量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="3.133ex" height="2.059ex" role="img" focusable="false" viewBox="0 -705 1385 910"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\nabla f"><g data-mml-node="mi" data-latex="\nabla"><path data-c="2207" d="M780 657C783 664 785 669 785 671C785 679 776 683 759 683L73 683C56 683 47 679 47 670L387-13C394-26 403-33 416-33C429-33 438-26 445-13M445 72L179 605L710 605Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(833,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg></mjx-container></span>与自变量位移向量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="2.631ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 1163 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathrm{d}\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathrm{d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(556,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>的点积。</p>
<p><strong>链式法则</strong>为我们做导数（梯度）计算提供了一种循序渐进的方式，通过将一个复杂函数拆解为一系列简单函数的复合函数，实现将复杂函数的梯度计算拆解为一系列简单函数的梯度计算结果的乘积。</p>
<h2><a id="toc-bc3" class="anchor" href="#toc-bc3"></a>自动微分</h2><p>主要介绍如何利用pytorch做“自动的”梯度计算。这里的“自动”，指的是在完成计算函数值<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 490 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y = f(x)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.692ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2957.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y = f(x)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(1055.8,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1607.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(1996.8,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2568.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>的过程（称为前向传播）后，可以通过执行<code>y.backward()</code>反过来把计算过程中涉及到的变量的梯度计算出来（称为反向传播）。通过<code>x.grad</code>可以取到执行反向传播的那个变量对x的梯度，在这个例子中就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>的梯度，也就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.819ex;" xmlns="http://www.w3.org/2000/svg" width="2.816ex" height="3.061ex" role="img" focusable="false" viewBox="0 -991.2 1244.7 1353.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\frac{\partial y}{\partial x}"><g data-mml-node="mfrac" data-latex="\frac{\partial y}{\partial x}"><g data-mml-node="mrow" transform="translate(249,485) scale(0.707)" data-latex="\partial y"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="y" transform="translate(566,0)"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g><g data-mml-node="mrow" transform="translate(220,-346.3) scale(0.707)" data-latex="\partial x"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(566,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g><rect width="1004.7" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>。</p>
<p>本节只讲用法，不讲原理。具体的实现过程会在后面的章节中详细介绍。</p>
<h2><a id="toc-e49" class="anchor" href="#toc-e49"></a>概率</h2><p>介绍概率论中的一些基本概念，包括：</p>
<ul>
<li>随机变量的定义</li>
<li>联合概率：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.283ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1893 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A=a,B=b)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(1143,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.309ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2788.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A=a,B=b)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(1055.8,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1584.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(2029.4,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.239ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1873.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A=a,B=b)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1055.8,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1484.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></li>
<li>条件概率：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.303ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1902 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(B=b \mid A=a)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(1143,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.359ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1484.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(B=b \mid A=a)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1055.8,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.954ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1305.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(B=b \mid A=a)"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(555.8,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.466ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1973.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(B=b \mid A=a)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(1055.8,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1584.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></li>
<li>贝叶斯定理：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.283ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1893 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(1143,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.855ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1703.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(555.8,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1314.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.231ex;" xmlns="http://www.w3.org/2000/svg" width="12.345ex" height="3.6ex" role="img" focusable="false" viewBox="0 -1047.1 5456.3 1591.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{P(B \mid A) P(A)}{P(B)}" transform="translate(1055.8,0)"><g data-mml-node="mrow" transform="translate(220,516.8) scale(0.707)" data-latex="P(B \mid A) P(A)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(1143,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g><g data-mml-node="mo" data-latex="\mid" transform="translate(1902,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(2180,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2930,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(3319,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4073,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(4462,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(5212,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(1390.3,-368.9) scale(0.707)" data-latex="P(B)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(1143,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1902,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="4160.5" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span></li>
<li>边际化：从包含多个变量的联合概率分布中，通过累加或积分不需要的变量，来计算出单个或部分变量的边缘概率分布的过程</li>
<li>独立性：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.697ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 750 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A \perp B \Leftrightarrow P(A, B) = P(A)P(B)"><g data-mml-node="mi" data-latex="A"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.106ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1814.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A \perp B \Leftrightarrow P(A, B) = P(A)P(B)"><g data-mml-node="mo" data-latex="\perp"><path data-c="27C2" d="M698 47L413 47L413 660C413 676 405 684 389 684C373 684 365 676 365 660L365 47L80 47C64 47 56 39 56 24C56 8 64 0 80 0L698 0C714 0 722 8 722 24C722 36 711 47 698 47Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(1055.8,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="10.777ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4763.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A \perp B \Leftrightarrow P(A, B) = P(A)P(B)"><g data-mml-node="mo" data-latex="\Leftrightarrow"><path data-c="21D4" d="M965 233C974 236 978 241 978 250C978 259 974 264 965 267C904 284 842 318 781 371C737 410 702 455 675 507C670 516 663 520 654 520C638 520 630 512 630 496C630 494 631 491 632 486C655 442 683 403 715 369L285 369C317 403 345 442 368 486C369 491 370 494 370 496C370 512 362 520 346 520C337 520 330 516 325 507C298 455 263 410 219 371C158 318 96 284 35 267C26 264 22 259 22 250C22 241 26 236 35 233C96 216 158 182 219 129C263 90 298 45 325-7C330-16 337-20 346-20C362-20 370-12 370 4C370 6 369 9 368 14C345 58 317 97 285 131L715 131C683 97 655 58 632 14C631 9 630 6 630 4C630-12 638-20 654-20C663-20 670-16 675-7C702 45 737 90 781 129C842 182 904 216 965 233M766 322C802 293 842 269 887 250C842 231 802 207 766 178L234 178C198 207 158 231 113 250C158 269 198 293 234 322Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(1277.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2031.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(2420.8,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3170.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(3615.4,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(4374.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="12.735ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 5628.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="A \perp B \Leftrightarrow P(A, B) = P(A)P(B)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(1055.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1809.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="A" transform="translate(2198.8,0)"><path data-c="1D434" d="M137 3C155 3 217 0 236 0C251 0 258 8 258 23C258 32 252 38 239 39C210 40 196 50 196 69C196 78 205 98 224 128C251 173 270 206 283 228L526 228C526 221 527 207 530 185C537 112 541 72 541 67C541 48 519 39 474 39C455 39 446 31 446 15C446 5 452 0 464 0C488 0 564 3 588 3C608 3 679 0 699 0C714 0 721 8 721 24C721 34 712 39 694 39C666 39 649 41 644 44C639 47 635 56 634 71L574 689C571 708 572 716 551 716C539 716 529 710 522 697L178 120C148 70 108 43 59 39C43 38 35 30 35 15C35 5 41 0 52 0C68 0 121 3 137 3M492 577L522 267L307 267Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2948.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(3337.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4091.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="B" transform="translate(4480.8,0)"><path data-c="1D435" d="M756 543C756 634 666 683 568 683L236 683C213 683 203 682 203 659C203 643 223 644 235 644C265 643 283 641 288 640C293 639 295 636 295 631C295 629 294 623 291 613L159 82C154 60 144 47 129 42C122 40 104 39 73 39C52 39 42 31 42 15C42 5 52 0 73 0L426 0C491 0 551 20 608 59C671 102 703 155 703 217C703 296 638 344 567 358C655 379 756 446 756 543M554 644C623 644 658 612 658 547C658 496 638 454 596 420C554 386 507 370 456 370L317 370L377 610C385 644 385 644 427 644M582 299C596 276 603 253 603 228C603 176 583 131 542 94C501 57 455 39 402 39L267 39C257 39 250 39 246 40C240 40 237 42 237 45C237 46 237 49 238 53C269 180 293 276 309 340L493 340C536 340 565 326 582 299Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(5239.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，两个随机变量是独立的，当且仅当两个随机变量的联合分布是其各自分布的乘积</li>
<li>期望与方差</li>
</ul>
<p>本节介绍的概率论的概念比较基础，想要完全理解后续章节的各类方法的理论推导还远远不够，不过下面我还会对其他的需要的概率知识做补充，虽然不一定能做到非常严密的推导，但至少可以从思维逻辑上讲清楚。</p>
<p>另外还有两个基础概念是本节没有介绍的，这里做个补充：</p>
<ul>
<li>概率质量/密度函数：<ul>
<li>概率质量函数(PMF)：专门用于离散型随机变量。它直接表示随机变量取到某个具体数值的真实概率。例如，掷一枚硬币正面朝上的概率。</li>
<li>概率密度函数(PDF)：专门用于连续型随机变量。因为连续变量取某一个精确值的概率为零，PDF描述的是变量落在某个区间内的“概率密集程度”（需要对区间求积分才能得到概率）。</li>
</ul>
</li>
<li>累积分布函数(CDF)：表示随机变量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.925ex" height="1.545ex" role="img" focusable="false" viewBox="0 -683 851 683"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="X"><g data-mml-node="mi" data-latex="X"><path data-c="1D44B" d="M834 683C817 683 758 680 741 680C721 680 651 683 631 683C616 683 608 675 608 659C608 650 613 645 624 644C648 641 660 633 660 618C660 609 654 598 642 585L486 417C457 485 429 552 400 620C401 622 402 624 405 626C414 636 431 642 455 644C471 646 479 654 479 667C479 678 473 683 460 683C436 683 359 680 335 680C314 680 245 683 224 683C209 683 202 675 202 659C202 649 211 644 229 644C274 644 288 644 300 615L416 342L208 119C205 116 201 112 196 109C155 66 108 42 53 39C36 38 27 29 27 14C30 5 31 0 44 0C61 0 120 3 137 3C158 3 227 0 248 0C263 0 270 8 270 24C270 33 265 38 254 39C230 41 218 50 218 65C218 75 227 89 244 107C306 173 369 239 430 306C464 225 499 145 532 63C531 61 530 59 527 56C518 47 502 42 478 39C463 37 455 29 455 16C455 5 461 0 474 0L599 3C620 3 690 0 708 0C723 0 731 8 731 23C731 33 724 38 709 39C678 39 658 40 651 44C644 48 636 60 628 80L501 383C569 455 620 509 653 546C677 571 693 588 702 595C739 626 780 642 825 644C846 645 851 650 851 669C848 678 847 683 834 683Z"/></g></g></g></svg></mjx-container></span>的取值小于或等于某一特定数值<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>的概率，等于PMF累加或PDF积分</li>
</ul>
<h1><a id="toc-5e0" class="anchor" href="#toc-5e0"></a>线性神经网络</h1><p>线性神经网络是深度学习的基础，真正搞懂它是非常重要的。</p>
<p>机器学习领域中的大多数任务通常都与<strong>预测</strong>有关。本章介绍了两类线性神经网络：<strong>线性回归</strong>和<strong>softmax回归</strong>，分别解决<strong>数值预测</strong>和<strong>分类预测</strong>问题。核心目的是：通过最简单的神经网络，讲清楚深度学习的基本概念和流程。</p>
<p>这里的神经网络，指的就是机器学习的4个关键组件之一——模型，而线性神经网络指的就是我们使用的模型是线性的。</p>
<p>如果我们能够得到<strong>输出（标签）</strong> 关于<strong>输入（特征）</strong> 的函数，我们就可以说我们能够实现<strong>预测</strong>。<strong>从本质上讲，深度学习就是设计这个函数所使用的模型，并用大量的输入输出数据去拟合函数，得到函数模型的参数的过程。</strong></p>
<h2><a id="toc-d8b" class="anchor" href="#toc-d8b"></a>线性回归</h2><p><strong>基本假设</strong>：线性回归解决数值预测问题，它采用线性的函数模型来进行预测，它的关键假设是：自变量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>和因变量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>之间的关系是线性的， 即<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>可以表示为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>中元素的加权和。</p>
<p><strong>模型</strong>：当我们的输入包含<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.176ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 520 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="d"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></svg></mjx-container></span>个特征时，我们将预测结果<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.333ex" role="img" focusable="false" viewBox="0 -826 490 1031"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y}"><g data-mml-node="TeXAtom" data-latex="\hat{y}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></svg></mjx-container></span>表示为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 490 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = w_1  x_1 + ... + w_d  x_d + b"><g data-mml-node="TeXAtom" data-latex="\hat{y}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.278ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3216.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = w_1  x_1 + ... + w_d  x_d + b"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="w_1" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mn" transform="translate(749,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="msub" data-latex="x_1" transform="translate(2208.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.15ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1834.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = w_1  x_1 + ... + w_d  x_d + b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(1000.2,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(1278.2,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(1556.2,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.216ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3189.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = w_1  x_1 + ... + w_d  x_d + b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="w_d" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g><g data-mml-node="msub" data-latex="x_d" transform="translate(2166.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.234ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1429.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = w_1  x_1 + ... + w_d  x_d + b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1000.2,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>，或者更简洁的点积形式<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 490 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = \mathbf{w}^\top \mathbf{x} + b"><g data-mml-node="TeXAtom" data-latex="\hat{y}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.074ex" height="2.449ex" role="img" focusable="false" viewBox="0 -832.5 3126.9 1082.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = \mathbf{w}^\top \mathbf{x} + b"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="\mathbf{w}^\top" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mi" transform="translate(864,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2519.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.234ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1429.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{y} = \mathbf{w}^\top \mathbf{x} + b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1000.2,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>。当我们用矩阵<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 869 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.995ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3091.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{n\times d}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n\times d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(600,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1378,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></g></svg></mjx-container></span>表示整个数据集的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>个样本时（每一行是一个样本，每一列是一种特征），<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>个样本的预测值向量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.439ex" role="img" focusable="false" viewBox="0 -828 607 1078"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="{\hat{\mathbf{y}}} = \mathbf{X} \mathbf{w} + b"><g data-mml-node="TeXAtom" data-latex="{\hat{\mathbf{y}}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.235ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2755.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="{\hat{\mathbf{y}}} = \mathbf{X} \mathbf{w} + b"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(1924.8,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.234ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1429.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="{\hat{\mathbf{y}}} = \mathbf{X} \mathbf{w} + b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1000.2,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>。</p>
<p><strong>损失函数</strong>：我们的目的是希望通过样本数据，得到最符合样本数据的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>。为了衡量“符合”的程度，我们需要定义一个关于<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>的函数，即损失函数，其中特征、标签、预测值均为参数，我们的目标是寻找一组参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.437ex;" xmlns="http://www.w3.org/2000/svg" width="5.832ex" height="2.007ex" role="img" focusable="false" viewBox="0 -694 2577.8 887"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}^*, b^*"><g data-mml-node="msup" data-latex="\mathbf{w}^*"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" transform="translate(864,363) scale(0.707)" data-latex="*"><path data-c="2217" d="M404 372C397 372 390 370 385 366L267 279L282 425C285 445 269 462 250 462C231 462 215 445 218 425L233 279L115 366C110 370 103 372 96 372C78 372 63 357 63 339C63 325 70 315 83 309L217 250L83 191C70 185 63 175 63 161C63 143 78 128 96 128C103 128 110 130 115 134L233 221L218 75C215 55 231 39 250 39C269 39 285 55 282 75L267 221L385 134C390 130 397 128 404 128C415 128 424 133 431 142C446 162 435 183 417 191L283 250L417 309C430 315 437 325 437 339C437 357 422 372 404 372Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1267.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msup" data-latex="b^*" transform="translate(1712.2,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" transform="translate(462,363) scale(0.707)" data-latex="*"><path data-c="2217" d="M404 372C397 372 390 370 385 366L267 279L282 425C285 445 269 462 250 462C231 462 215 445 218 425L233 279L115 366C110 370 103 372 96 372C78 372 63 357 63 339C63 325 70 315 83 309L217 250L83 191C70 185 63 175 63 161C63 143 78 128 96 128C103 128 110 130 115 134L233 221L218 75C215 55 231 39 250 39C269 39 285 55 282 75L267 221L385 134C390 130 397 128 404 128C415 128 424 133 431 142C446 162 435 183 417 191L283 250L417 309C430 315 437 325 437 339C437 357 422 372 404 372Z"/></g></g></g></g></svg></mjx-container></span>，能最小化在所有训练样本上的总损失<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="7.158ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 3163.7 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L(\mathbf{w}, b)"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(681,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(1070,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1901,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(2345.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2774.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="55.961ex" height="6.24ex" role="img" focusable="false" viewBox="0 -1562.5 24734.9 2758.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L(\mathbf{w}, b) =\frac{1}{n}\sum_{i=1}^n l^{(i)}(\mathbf{w}, b) =\frac{1}{n} \sum_{i=1}^n \frac{1}{2}\left(\mathbf{w}^\top \mathbf{x}^{(i)} + b - y^{(i)}\right)^2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(681,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(1070,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1901,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(2345.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2774.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3441.4,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{n}" transform="translate(4497.2,0)"><g data-mml-node="mn" data-latex="1" transform="translate(270,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" data-latex="n" transform="translate(220,-686)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><rect width="800" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^n" transform="translate(5703.9,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(148.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(509.9,1150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="msup" data-latex="l^{(i)}" transform="translate(7314.6,0)"><g data-mml-node="mi" data-latex="l"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="TeXAtom" transform="translate(331,413) scale(0.707)" data-latex="{(i)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(389,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(734,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(8489.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(8878.6,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(9709.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(10154.3,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(10583.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(11250.1,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{n}" transform="translate(12305.9,0)"><g data-mml-node="mn" data-latex="1" transform="translate(270,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" data-latex="n" transform="translate(220,-686)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><rect width="800" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^n" transform="translate(13512.5,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(148.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(509.9,1150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="mfrac" data-latex="\frac{1}{2}" transform="translate(15123.2,0)"><g data-mml-node="mn" data-latex="1" transform="translate(220,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(220,-686)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="700" height="60" x="120" y="220"/></g><g data-mml-node="msup" data-latex="\left(\mathbf{w}^\top \mathbf{x}^{(i)} + b - y^{(i)}\right)^2" transform="translate(16063.2,0)"><g data-mml-node="mrow" data-latex="\left(\mathbf{w}^\top \mathbf{x}^{(i)} + b - y^{(i)}\right)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M444-472C455-472 461-466 461-455C461-449 459-445 454-442C382-387 325-294 282-164C245-53 226 57 226 164L226 336C226 443 245 552 282 664C325 793 382 886 454 942C459 945 461 949 461 955C461 966 455 972 444 972C440 972 437 971 434 968C353 905 285 809 232 681C181 560 156 445 156 336L156 164C156 55 181-60 232-181C285-310 353-405 434-468C437-471 440-472 444-472Z"/></g><g data-mml-node="msup" data-latex="\mathbf{w}^\top" transform="translate(523,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mi" transform="translate(864,413) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="msup" data-latex="\mathbf{x}^{(i)}" transform="translate(1987.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(640,413) scale(0.707)" data-latex="{(i)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(389,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(734,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(3693.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(4693.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(5344.9,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msup" data-latex="y^{(i)}" transform="translate(6345.1,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,413) scale(0.707)" data-latex="{(i)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(389,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(734,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(7712.2,0)"><path data-c="29" d="M89-468C170-405 238-310 291-181C342-60 367 55 367 164L367 336C367 445 342 560 291 681C238 810 170 905 89 968C85 971 82 972 79 972C68 972 62 966 62 955C62 950 64 945 68 942C140 887 198 795 241 664C278 552 297 443 297 336L297 164C297 57 278-52 241-164C198-295 140-387 68-442C64-445 62-450 62-455C62-466 68-472 79-472C82-472 86-471 89-468Z"/></g></g><g data-mml-node="mn" transform="translate(8268.2,699.1) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>这里，我们的损失函数是平方损失，即标签与预测值之差的平方。但为什么是平方损失？这是因为我们假设了观测中包含噪声，其中噪声服从正态分布，通过极大似然估计法，参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>的最优值是使整个数据集的似然（通过给定<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>观测到特定<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>）最大的值。最终可以推导出：在高斯噪声的假设下，最小化均方误差等价于对线性模型的极大似然估计。</p>
<p>需要注意的是，我们要优化的问题是损失函数的值，损失函数相当于在模型函数（输出关于输入的函数）基础上用样本数据做了复合，并把函数的自变量从输入变成了模型参数。</p>
<p><strong>优化算法</strong>：其实线性回归问题是有解析解的，想象一下：先假设没有观测误差的情况，每一个样本数据就可以列出一个关于<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>的方程，只要线性无关的样本数量与参数（也就是方程的未知数）相同，就可以得到方程组的唯一解；再假设有观测误差的情况，也就是最小化平方损失，我们合并<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>到<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>中，只需要设其对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>的导数为0，就可以得到解析解。但并不是所有的问题都存在解析解，所以我们采用数值方法得到数值解，这种方法叫做<em>随机梯度下降</em>。</p>
<p>梯度的定义是“函数增长最快的方向”，于是我们可以在求出损失函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="7.158ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 3163.7 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L(\mathbf{w}, b)"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(681,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(1070,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1901,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(2345.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2774.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>关于参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>的梯度后，通过每次沿着梯度的反方向修改<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.971ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 429 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>的值，就可以不断降低损失函数的值。</p>
<p>为什么沿着梯度的反方向就可以不断降低损失函数的值？我们先设想一维场景：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>关于<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>的导数表达了<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>随<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>的变化方向和变化率，为正则表示<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>随<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>的增加而增加，为负则表示<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>随<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>的增加而减少，所以随着导数的反方向调整<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>的值意味着朝着<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>减少的方向调整<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>。这个导数扩展到多维场景就是梯度。</p>
<h2><a id="toc-b68" class="anchor" href="#toc-b68"></a>softmax回归</h2><p>softmax回归核心要解决的问题就是：如何将线性模型应用到分类问题中？</p>
<p>假设我们有4个特征<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.034ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 899 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_i"><g data-mml-node="msub" data-latex="x_i"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>和3个可能的输出类别<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.837ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 812 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="o_i"><g data-mml-node="msub" data-latex="o_i"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>，我们可以用这样的一个线性模型（12个标量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="3.019ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 1334.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w_{ij}"><g data-mml-node="msub" data-latex="w_{ij}"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{i j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(345,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>来表示权重、3个标量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.71ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 756 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="b_i"><g data-mml-node="msub" data-latex="b_i"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mi" transform="translate(462,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>来表示偏置）来表示：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -3.507ex;" xmlns="http://www.w3.org/2000/svg" width="40.88ex" height="8.145ex" role="img" focusable="false" viewBox="0 -2050 18069.1 3600"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
o_1 &amp;= x_1 w_{11} + x_2 w_{12} + x_3 w_{13} + x_4 w_{14} + b_1\\
o_2 &amp;= x_1 w_{21} + x_2 w_{22} + x_3 w_{23} + x_4 w_{24} + b_2\\
o_3 &amp;= x_1 w_{31} + x_2 w_{32} + x_3 w_{33} + x_4 w_{34} + b_3
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
o_1  &amp;= x_1  w_{11} + x_2  w_{12} + x_3  w_{13} + x_4  w_{14} + b_1 \\
o_2  &amp;= x_1  w_{21} + x_2  w_{22} + x_3  w_{23} + x_4  w_{24} + b_2 \\
o_3  &amp;= x_1  w_{31} + x_2  w_{32} + x_3  w_{33} + x_4  w_{34} + b_3 
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1300)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="o_1"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mn" transform="translate(518,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mtd" transform="translate(921.6,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1333.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{11}" transform="translate(2342.1,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{11}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="11"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(4070.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(5070.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{12}" transform="translate(6079.2,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{12}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="12"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7807.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(8807.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="msub" data-latex="w_{13}" transform="translate(9816.3,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{13}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="13"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11544.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_4" transform="translate(12544.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="4"><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z"/></g></g><g data-mml-node="msub" data-latex="w_{14}" transform="translate(13553.4,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{14}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="14"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(15281.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="b_1" transform="translate(16282,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mn" transform="translate(462,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,0)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="o_2"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mn" transform="translate(518,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g><g data-mml-node="mtd" transform="translate(921.6,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1333.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{21}" transform="translate(2342.1,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{21}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="21"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(4070.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(5070.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{22}" transform="translate(6079.2,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{22}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="22"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7807.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(8807.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="msub" data-latex="w_{23}" transform="translate(9816.3,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{23}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="23"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11544.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_4" transform="translate(12544.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="4"><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z"/></g></g><g data-mml-node="msub" data-latex="w_{24}" transform="translate(13553.4,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{24}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="24"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(15281.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="b_2" transform="translate(16282,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mn" transform="translate(462,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1300)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="o_3"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mn" transform="translate(518,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g></g><g data-mml-node="mtd" transform="translate(921.6,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1333.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{31}" transform="translate(2342.1,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{31}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="31"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(4070.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(5070.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="msub" data-latex="w_{32}" transform="translate(6079.2,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{32}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="32"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7807.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(8807.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="msub" data-latex="w_{33}" transform="translate(9816.3,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{33}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="33"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11544.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="x_4" transform="translate(12544.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="4"><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z"/></g></g><g data-mml-node="msub" data-latex="w_{34}" transform="translate(13553.4,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{34}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="34"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/><path data-c="34" d="M353 677C344 677 336 672 330 663L28 199L28 163L289 163L289 81C289 63 285 51 278 46C271 41 252 39 219 39L194 39L194 0C223 2 269 3 331 3C393 3 439 2 468 0L468 39L443 39C410 39 391 41 384 46C377 51 373 63 373 81L373 163L471 163L471 202L373 202L373 660C373 670 366 677 353 677M295 553L295 202L67 202Z" transform="translate(500,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(15281.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="b_3" transform="translate(16282,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mn" transform="translate(462,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>用向量形式可以表达为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.301ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 575 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o} = \mathbf{W} \mathbf{x} + \mathbf{b}"><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.452ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2851.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o} = \mathbf{W} \mathbf{x} + \mathbf{b}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2244.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.709ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1639.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o} = \mathbf{W} \mathbf{x} + \mathbf{b}"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g></g></g></svg></mjx-container></span>。在多样本的情况下（特征<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.176ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 520 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="d"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></svg></mjx-container></span>个、样本<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>个、类别<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="1.023ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 452 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="q"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></svg></mjx-container></span>个）表达为：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.955ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 864 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{O} = \mathbf{X} \mathbf{W} + \mathbf{b}"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.045ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3113.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{O} = \mathbf{X} \mathbf{W} + \mathbf{b}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1924.8,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.709ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1639.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{O} = \mathbf{X} \mathbf{W} + \mathbf{b}"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g></g></g></svg></mjx-container></span>（特征为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 869 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.995ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3091.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{n\times d}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n\times d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(600,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1378,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></g></svg></mjx-container></span>，权重为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1189 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W} \in \mathbb{R}^{d \times q}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.758ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 2987.2 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W} \in \mathbb{R}^{d \times q}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{d\times q}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{d\times q}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(520,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(1298,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></svg></mjx-container></span>，偏置为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.446ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 639 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{b} \in \mathbb{R}^{1\times q}"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.726ex" height="2.452ex" role="img" focusable="false" viewBox="0 -833.9 2973.1 1083.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{b} \in \mathbb{R}^{1\times q}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{1\times q}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{1\times q}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(500,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(1278,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></svg></mjx-container></span>）。</p>
<p>但至此我们还存在一个问题：输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.014ex;" xmlns="http://www.w3.org/2000/svg" width="1.301ex" height="1.038ex" role="img" focusable="false" viewBox="0 -453 575 459"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o}"><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g></g></g></svg></mjx-container></span>怎么对应到预测的分类上？一个简单的想法是：选择一个最大的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.837ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 812 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="o_i"><g data-mml-node="msub" data-latex="o_i"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>作为我们预测的那个分类。这个想法是合理的，但现在面临一个新的问题：我们该如何定义损失函数以优化这个模型？</p>
<p>类似于我们在线性回归中的方法，我们自然想到利用极大似然估计推导出损失函数，但首先我们需要将输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.014ex;" xmlns="http://www.w3.org/2000/svg" width="1.301ex" height="1.038ex" role="img" focusable="false" viewBox="0 -453 575 459"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o}"><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g></g></g></svg></mjx-container></span>转化为概率。</p>
<p>教材中给出的方法是利用softmax运算，将输出转化为预测概率向量（每个分类的预测概率）：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.439ex" role="img" focusable="false" viewBox="0 -828 607 1078"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{\mathbf{y}} = \mathrm{softmax}(\mathbf{o})"><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="13.255ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 5858.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{\mathbf{y}} = \mathrm{softmax}(\mathbf{o})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathrm{softmax}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="softmax"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(4505.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD" transform="translate(4894.8,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5469.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，但并没有解释为什么要用softmax运算而不是其他运算，并且在损失函数推导中没有像线性回归一样基于噪声模型做推导，而是直接使用softmax运算得到的概率进行极大似然估计。</p>
<p>想要解释这个问题，关键还是在于<strong>为什么要选softmax运算</strong>。由于分类问题要解决的就是给定输入预测其属于各个类别的条件概率，在特征与标签之间存在线性关联的假设下，我们可以从两方面来解释：</p>
<ul>
<li><strong>从噪声角度</strong>：如果假设噪声是逻辑分布，条件概率分布就是对输出结果取softmax</li>
<li><strong>从信息论中的最大熵原理角度</strong>：熵最大的条件概率分布就是对输出结果取softmax</li>
</ul>
<p><strong>所以并不是在softmax回归问题中没有噪声，而是对输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.014ex;" xmlns="http://www.w3.org/2000/svg" width="1.301ex" height="1.038ex" role="img" focusable="false" viewBox="0 -453 575 459"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{o}"><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g></g></g></svg></mjx-container></span>的数值结果进行softmax运算转化为概率的过程就已经蕴含了对噪声的假设，是将“连续误差”的假设转换为了“类别概率（离散选择）”的假设。</strong></p>
<blockquote>
<p>我们再换个角度来理解。我们依然采用与线性回归一样的极大似然估计的方式：让在给定的特征观测到特定标签的似然最大化，这在分类问题上等于是最大化整个数据集上的预测正确的概率乘积。给定的特征观测到特定标签的概率是什么？取决于噪声是怎样的。如果没有噪声，就是在求线性模型的解析解（或是其他模型的插值问题）而非回归问题。在噪声是逻辑分布的假设下，这个概率就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="10.867ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 4803 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathrm{softmax}(\mathbf{o})"><g data-mml-node="TeXAtom" data-latex="\mathrm{softmax}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="softmax"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(3450,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{o}" data-mjx-texclass="ORD" transform="translate(3839,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D428" d="M542 218C542 352 450 453 287 453C123 453 32 351 32 218C32 94 120-6 287-6C455-6 542 95 542 218M414 229C414 142 414 34 287 34C160 34 160 142 160 229C160 274 160 325 177 359C196 396 238 417 287 417C329 417 371 401 393 366C414 332 414 277 414 229Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4414,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>。极大似然估计的过程就是在该噪声假设下寻找最优参数的过程。</p>
</blockquote>
<p>因此，基于softmax后的概率进行极大似然估计，我们很容易得到极大似然估计等价于最小化损失函数：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -10.103ex;" xmlns="http://www.w3.org/2000/svg" width="34.75ex" height="21.337ex" role="img" focusable="false" viewBox="0 -4965.4 15359.4 9430.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
l(\mathbf{y}, \hat{\mathbf{y}}) &amp;= - \sum_{j=1}^q y_j \log \hat{y}_j \\
&amp;=  - \sum_{j=1}^q y_j \log \frac{\exp(o_j)}{\sum_{k=1}^q \exp(o_k)} \\
&amp;= \log \sum_{k=1}^q \exp(o_k) - \sum_{j=1}^q y_j o_j.
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
l(\mathbf{y}, \hat{\mathbf{y}}) &amp;= - \sum_{j=1}^q y_j \log \hat{y}_j \\
&amp;=  - \sum_{j=1}^q y_j \log \frac{\exp(o_j)}{\sum_{k=1}^q \exp(o_k)} \\
&amp;= \log \sum_{k=1}^q \exp(o_k) - \sum_{j=1}^q y_j o_j.
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,3354.7)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="l"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(298,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(687,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1294,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD" transform="translate(1738.7,0)"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2345.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(2734.7,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1333.6,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="munderover" data-latex="\sum_{j=1}^q" transform="translate(2278.2,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(124.5,-1087.9) scale(0.707)" data-latex="{j=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(562.2,1198.2) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="msub" data-latex="y_j" transform="translate(3888.9,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(4919.9,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(6197.9,0)"><path data-c="2061" d=""/></g><g data-mml-node="msub" data-latex="\hat{y}_j" transform="translate(6364.6,0)"><g data-mml-node="TeXAtom" data-latex="\hat{y}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,111.1)"><g data-mml-node="mtd" transform="translate(2734.7,0)"/><g data-mml-node="mtd" transform="translate(2734.7,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1333.6,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="munderover" data-latex="\sum_{j=1}^q" transform="translate(2278.2,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(124.5,-1087.9) scale(0.707)" data-latex="{j=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(562.2,1198.2) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="msub" data-latex="y_j" transform="translate(3888.9,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(4919.9,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(6197.9,0)"><path data-c="2061" d=""/></g><g data-mml-node="mfrac" data-latex="\frac{\exp(o_j)}{\sum_{k=1}^q \exp(o_k)}" transform="translate(6364.6,0)"><g data-mml-node="mrow" data-latex="\exp(o_j)" transform="translate(1547.4,755)"><g data-mml-node="mi" data-latex="\exp"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(1528,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1528,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="o_j" transform="translate(1917,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2776.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\sum_{k=1}^q \exp(o_k)" transform="translate(220,-763.3)"><g data-mml-node="munderover" data-latex="\sum_{k=1}^q"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,490.8) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(1089,-317.1) scale(0.707)" data-latex="{k=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(521,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1299,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="\exp" transform="translate(2577.8,0)"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(4105.8,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(4105.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="o_k" transform="translate(4494.8,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5431.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="6020.2" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-3132.5)"><g data-mml-node="mtd" transform="translate(2734.7,0)"/><g data-mml-node="mtd" transform="translate(2734.7,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\log" transform="translate(1333.6,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(2611.6,0)"><path data-c="2061" d=""/></g><g data-mml-node="munderover" data-latex="\sum_{k=1}^q" transform="translate(2778.2,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(86,-1107.7) scale(0.707)" data-latex="{k=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(521,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1299,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(562.2,1198.2) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="mi" data-latex="\exp" transform="translate(4388.9,0)"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(5916.9,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(5916.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="o_k" transform="translate(6305.9,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7242.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(7853.5,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="munderover" data-latex="\sum_{j=1}^q" transform="translate(8853.7,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(124.5,-1087.9) scale(0.707)" data-latex="{j=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(562.2,1198.2) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="msub" data-latex="y_j" transform="translate(10464.4,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="msub" data-latex="o_j" transform="translate(11328.7,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="." transform="translate(12188.1,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>该损失函数也被称为交叉熵损失。从信息论的角度理解交叉熵的含义：只要预测概率分布与真实概率不一样，就一定比真实概率的熵大，所以我们希望最小化交叉熵。交叉熵不是“预测分布自身蕴含的信息量”，而是“用预测分布去适配真实数据时，产生的额外代价/浪费”。</p>
<p>另外注意一个工程上的点，在简洁实现中，使用了<code>nn.CrossEntropyLoss</code>作为损失函数，它内部做了softmax运算，所以我们无需针对网络的输出层单独手动做softmax运算。</p>
<h1><a id="toc-55d" class="anchor" href="#toc-55d"></a>多层感知机</h1><div class="markdown-alert markdown-alert-important">
<p class="markdown-alert-title"><svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>d2l包中缺少了本章所要使用的一些函数，所以需要把<code>train_ch3</code>、<code>train_epoch_ch3</code>、<code>evaluate_accuracy</code>、<code>predict_ch3</code>等函数手动复制到<code>Lib\site-packages\d2l\torch.py</code>目录中。</p>
</div>
<h2><a id="toc-7b3" class="anchor" href="#toc-7b3"></a>多层感知机原理</h2><p>线性意味着单调假设： 任何特征的增大都会导致模型输出的增大（如果对应的权重为正）， 或者导致模型输出的减小（如果对应的权重为负）。因此，线性模型是一个很强的假设。</p>
<p>由于线性模型无论叠加多少次线性运算永远都是线性模型，为了让模型能够进行非线性的预测，我们可以通过在线性模型中引入非线性层来克服线性模型的限制，使其能处理更普遍的函数关系类型。</p>
<p>在输入层和输出层中间的层叫做隐藏层，我们只要添加非线性的隐藏层即可，最简单的方式是，针对线性层的输出结果应用一个非线性的激活函数，就可以将该层转变为非线性层。最常见的激活函数是ReLU函数。</p>
<h2><a id="toc-e8f" class="anchor" href="#toc-e8f"></a>模型选择、欠拟合和过拟合</h2><ul>
<li>欠拟合：训练误差和验证误差都很严重，模型不能降低训练误差。这可能意味着模型过于简单（即表达能力不足）。</li>
<li>过拟合：训练误差明显低于验证误差。模型倾向于记住样本的数据规律，泛化性可能会变差。但过拟合并不总是一件坏事，关键还是看验证误差的情况。</li>
</ul>
<p>是否过拟合或欠拟合可能取决于<strong>模型复杂性</strong>和<strong>可用训练数据集的大小</strong>。</p>
<p>接下来教材使用了一个多项式回归的例子来说明模型复杂性与欠拟合和过拟合的影响：对于一个三阶多项式下得到的样本数据，使用线性函数拟合会欠拟合，使用高阶多项式函数拟合会过拟合。</p>
<h2><a id="toc-6b2" class="anchor" href="#toc-6b2"></a>权重衰减</h2><p>为了解决过拟合的问题，我们引入<strong>权重衰减</strong>这一正则化模型的技术。<strong>这是一种可以在不去收集更多的训练数据，也不用调整模型复杂性来缓解过拟合的一种有效手段。</strong></p>
<p>经典泛化理论认为，为了缩小训练和测试性能之间的差距，<strong>应该以简单的模型为目标</strong>。<strong>权重衰减</strong>是最广泛使用的正则化的技术之一，通常被称为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>正则化，这项技术通过函数与零的距离来衡量函数的复杂度，希望通过一种手段让训练后的模型尽可能简单，即<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span>比较小。</p>
<p>想要实现这一点，最常用方法是将其范数作为惩罚项加到最小化损失的问题中，将原来的训练目标最小化训练标签上的预测损失，调整为最小化预测损失和惩罚项之和：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.158ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3163.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L(\mathbf{w}, b) + \frac{\lambda}{2} \|\mathbf{w}\|^2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(681,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(1070,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1901,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(2345.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2774.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.781ex;" xmlns="http://www.w3.org/2000/svg" width="8.86ex" height="2.782ex" role="img" focusable="false" viewBox="0 -884.7 3916 1229.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L(\mathbf{w}, b) + \frac{\lambda}{2} \|\mathbf{w}\|^2"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\lambda}{2}" transform="translate(1000.2,0)"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="\lambda"><path data-c="1D706" d="M86-13C97-13 109-6 122 9L355 285C390 189 416 117 433 68C444 37 451 19 456 12C467-3 486-11 512-11L533-11C543-10 548-6 548 3C548 5 546 9 542 14C535 21 528 36 520 59L319 621C302 670 261 694 196 694C181 694 174 689 174 679C174 672 180 667 191 664C205 660 214 655 219 649C226 641 236 621 247 589L342 322L72 53C59 40 53 29 53 20C53 2 68-13 86-13Z"/></g><g data-mml-node="mn" transform="translate(249.3,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="612.2" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\|" transform="translate(1852.5,0)"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD" transform="translate(2250.5,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="msup" data-latex="\|^2" transform="translate(3081.5,0)"><g data-mml-node="mo" data-latex="\|"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="mn" transform="translate(431,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>。</p>
<p>接下来教材使用了高维线性回归的例子（200维的线性模型、20个样本的小训练集）演示了过拟合如何产生以及如何通过权重衰减来缓解。</p>
<p>但是，我们还没有讨论一个问题：<strong>为什么我们要选择<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>正则化而不是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>正则化</strong>？教材中的解释是：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>正则化对权重向量的大分量施加了巨大的惩罚，使得我们的学习算法偏向于在大量特征上均匀分布权重的模型，在实践中，这可能使它们对单个变量中的观测误差更为稳定；<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>惩罚会导致模型将权重集中在一小部分特征上，而将其他权重清除为零，这称为<em>特征选择</em>。相比特征选择会离散地决定某些特征要还是不要，权重衰减为我们提供了一种连续的机制来调整函数的复杂度。</p>
<p><strong>但是为什么<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>惩罚会有这样的效果</strong>？这是因为：无论权重本身是大是小，<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>惩罚都会施加一个大小恒定、方向始终指向0的梯度；而<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>惩罚的拉力随权重成正比衰减。</p>
<p>此外，<strong>我们还可以从概率的角度来解释正则化的科学性</strong>。教材中最后一题提到了基于贝叶斯公式的后验计算：<code>后验 = 似然 * 先验 / 边缘似然（证据）</code>。详细解释如下：</p>
<p>之前我们在推导损失函数时，用的都是极大似然估计。如果我们从后验的角度去考虑，根据贝叶斯公式，<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>的后验概率为：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.172ex;" xmlns="http://www.w3.org/2000/svg" width="54.726ex" height="5.475ex" role="img" focusable="false" viewBox="0 -1460 24188.8 2420"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W} \mid \mathbf{x},\mathbf{y}) = \frac{P(\mathbf{y} \mid \mathbf{x},\mathbf{W}) P(\mathbf{W})}{P(\mathbf{y} \mid \mathbf{x})} \propto P(\mathbf{y} \mid \mathbf{x},\mathbf{W}) P(\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(2609.8,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(3165.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3772.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(4217.2,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4824.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(5491,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{P(\mathbf{y} \mid \mathbf{x},\mathbf{W}) P(\mathbf{W})}{P(\mathbf{y} \mid \mathbf{x})}" transform="translate(6546.8,0)"><g data-mml-node="mrow" data-latex="P(\mathbf{y} \mid \mathbf{x},\mathbf{W}) P(\mathbf{W})" transform="translate(220,710)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(2027.8,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2583.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3190.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(3635.2,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4824.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(5213.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(5967.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(6356.2,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7545.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="P(\mathbf{y} \mid \mathbf{x})" transform="translate(2397.3,-710)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(2027.8,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2583.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3190.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="8134.2" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\propto" transform="translate(15198.8,0)"><path data-c="221D" d="M462 277C435 317 407 351 380 379C340 421 291 442 232 442C177 442 132 417 99 367C70 324 56 273 56 215C56 157 70 106 98 63C131 14 175-11 230-11C338-11 412 72 453 154C480 114 507 80 534 52C575 10 624-11 682-11C695-11 709-9 722-6L722 41C707 38 698 37 695 37C659 37 626 53 596 85C577 106 555 136 530 173L488 235C504 271 528 307 559 344C595 385 639 406 691 406C701 406 711 404 722 401C722 423 720 436 717 439C710 441 699 442 684 442C577 442 502 359 462 277M385 258L426 196C410 160 386 124 355 87C319 46 275 25 223 25C178 25 143 46 118 89C97 125 86 167 86 215C86 260 97 299 118 334C143 374 177 394 219 394C256 394 289 378 318 346C337 325 360 295 385 258Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(16254.6,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(17008.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(17397.6,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(18282.3,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(18838.1,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(19445.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(19889.8,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(21078.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(21467.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(22221.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(22610.8,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(23799.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>极大后验估计（最小化负对数后验估计）相比极大似然估计，损失函数会多出来一项<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="6.156ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2721 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2332,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>（其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.959ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1750 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{y} \mid \mathbf{x})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.511ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1551.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{y} \mid \mathbf{x})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1162.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>与<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>无关，所以我们使用正比而忽略它）。因此我们可以说：<strong>正则化等价于给权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>设定特定的先验分布<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="6.156ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2721 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2332,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></strong>。也就是说：</p>
<ul>
<li>不带正则的训练（只最小化损失） = 极大似然估计（MLE）：最大化<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.959ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1750 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{y} \mid \mathbf{x},\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.207ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3185.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{y} \mid \mathbf{x},\mathbf{W})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1162.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1607.4,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2796.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，完全相信观测数据，对参数没有任何预设，容易被训练数据里的噪声带偏，也就是过拟合。</li>
<li>带正则的训练（损失 + 惩罚项） = 极大后验估计（MAP）：最大化<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.276ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2332 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W} \mid \mathbf{x},\mathbf{y})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.89ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2603.4 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W} \mid \mathbf{x},\mathbf{y})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1162.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1607.4,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2214.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，既参考观测数据，也保留我们对参数的先验常识。</li>
</ul>
<p>因此，<strong>正则化不是强行惩罚大权重，而是在数据之外，引入我们对模型参数的合理信念。我们对权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>设定的特定的先验分布<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="6.156ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2721 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2332,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，决定了我们将采用什么样的正则化</strong>：</p>
<ul>
<li><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>权重衰减的平方惩罚，本质对应给权重加零均值高斯先验：我们默认“所有权重都不该太大”，用高斯分布把这个信念量化，就得到了<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>权重衰减</li>
<li><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>正则的绝对值惩罚，本质对应给权重加拉普拉斯先验：我们默认“只有少数特征重要、大多数权重应该是0”，用拉普拉斯分布把这个信念量化，就得到了<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_1"><g data-mml-node="msub" data-latex="L_1"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></svg></mjx-container></span>稀疏正则。</li>
</ul>
<p><strong>对于网络有多层的情况，我们只需要让惩罚项是所有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.781ex;" xmlns="http://www.w3.org/2000/svg" width="7.808ex" height="2.782ex" role="img" focusable="false" viewBox="0 -884.7 3451.3 1229.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\frac{\lambda}{2} \|\mathbf{W}\|_F^2"><g data-mml-node="mfrac" data-latex="\frac{\lambda}{2}"><g data-mml-node="mi" transform="translate(220,394) scale(0.707)" data-latex="\lambda"><path data-c="1D706" d="M86-13C97-13 109-6 122 9L355 285C390 189 416 117 433 68C444 37 451 19 456 12C467-3 486-11 512-11L533-11C543-10 548-6 548 3C548 5 546 9 542 14C535 21 528 36 520 59L319 621C302 670 261 694 196 694C181 694 174 689 174 679C174 672 180 667 191 664C205 660 214 655 219 649C226 641 236 621 247 589L342 322L72 53C59 40 53 29 53 20C53 2 68-13 86-13Z"/></g><g data-mml-node="mn" transform="translate(249.3,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="612.2" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\|" transform="translate(852.2,0)"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1250.2,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="msubsup" data-latex="\|_F^2" transform="translate(2439.2,0)"><g data-mml-node="mo" data-latex="\|"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="mn" transform="translate(431,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" transform="translate(431,-297.8) scale(0.707)" data-latex="F"><path data-c="1D439" d="M199 656C199 646 210 641 231 641C271 641 291 637 291 628C291 625 289 618 286 605L156 82C150 60 140 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L187 3L335 0C351 0 359 8 359 23C359 40 348 39 322 39C278 39 253 41 247 46C244 47 243 51 243 56L307 321L400 321C446 321 478 319 478 281C478 268 476 252 471 233C470 230 469 226 468 222C468 211 473 206 484 206C489 207 496 214 503 229L557 444C559 452 560 458 560 461C557 470 551 475 544 475C536 475 530 467 526 452C516 414 502 390 486 378C470 366 442 360 402 360L317 360L379 606C387 640 387 641 429 641L559 641C656 641 700 626 700 537C700 517 699 499 697 484C696 473 695 467 695 466C695 455 700 450 710 450C720 450 726 459 728 478L748 649C751 677 744 680 717 680L233 680C210 680 199 679 199 656Z"/></g></g></g></g></svg></mjx-container></span>之和即可</strong>。这是因为我们假设网络中每一层的权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.437ex;" xmlns="http://www.w3.org/2000/svg" width="14.949ex" height="1.982ex" role="img" focusable="false" viewBox="0 -683 6607.3 876"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="W_1, W_2, \dots, W_L"><g data-mml-node="msub" data-latex="W_1"><g data-mml-node="mi" data-latex="W"><path data-c="1D44A" d="M956 680C937 680 872 683 853 683C838 683 830 675 830 660C830 650 836 645 848 644C885 643 903 632 903 610C903 604 899 594 891 579L629 125L594 602C590 638 614 644 659 644C680 644 690 652 690 668C690 678 684 683 671 683C649 683 572 680 550 680C531 680 465 683 446 683C431 683 423 675 423 659C423 649 432 644 451 644C482 644 498 637 499 623L505 548L261 125L225 613C222 638 264 644 296 644C313 644 321 652 321 668C321 678 315 683 303 683C281 683 203 680 181 680C162 680 96 683 77 683C62 683 55 675 55 660C55 649 65 644 84 644C126 644 130 642 132 612L177 7C178-12 185-22 197-22C210-20 215-17 223-2C224-1 224 0 224 1L509 494L545 7C546-12 553-22 565-22C575-22 584-15 592-1L918 562C945 611 964 639 1025 644C1043 646 1048 651 1048 668C1048 678 1043 683 1032 683C1018 683 970 680 956 680Z"/></g><g data-mml-node="mn" transform="translate(977,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1380.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="W_2" transform="translate(1825.2,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D44A" d="M956 680C937 680 872 683 853 683C838 683 830 675 830 660C830 650 836 645 848 644C885 643 903 632 903 610C903 604 899 594 891 579L629 125L594 602C590 638 614 644 659 644C680 644 690 652 690 668C690 678 684 683 671 683C649 683 572 680 550 680C531 680 465 683 446 683C431 683 423 675 423 659C423 649 432 644 451 644C482 644 498 637 499 623L505 548L261 125L225 613C222 638 264 644 296 644C313 644 321 652 321 668C321 678 315 683 303 683C281 683 203 680 181 680C162 680 96 683 77 683C62 683 55 675 55 660C55 649 65 644 84 644C126 644 130 642 132 612L177 7C178-12 185-22 197-22C210-20 215-17 223-2C224-1 224 0 224 1L509 494L545 7C546-12 553-22 565-22C575-22 584-15 592-1L918 562C945 611 964 639 1025 644C1043 646 1048 651 1048 668C1048 678 1043 683 1032 683C1018 683 970 680 956 680Z"/></g><g data-mml-node="mn" transform="translate(977,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3205.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" transform="translate(3650.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(4654.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="W_L" transform="translate(5098.8,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D44A" d="M956 680C937 680 872 683 853 683C838 683 830 675 830 660C830 650 836 645 848 644C885 643 903 632 903 610C903 604 899 594 891 579L629 125L594 602C590 638 614 644 659 644C680 644 690 652 690 668C690 678 684 683 671 683C649 683 572 680 550 680C531 680 465 683 446 683C431 683 423 675 423 659C423 649 432 644 451 644C482 644 498 637 499 623L505 548L261 125L225 613C222 638 264 644 296 644C313 644 321 652 321 668C321 678 315 683 303 683C281 683 203 680 181 680C162 680 96 683 77 683C62 683 55 675 55 660C55 649 65 644 84 644C126 644 130 642 132 612L177 7C178-12 185-22 197-22C210-20 215-17 223-2C224-1 224 0 224 1L509 494L545 7C546-12 553-22 565-22C575-22 584-15 592-1L918 562C945 611 964 639 1025 644C1043 646 1048 651 1048 668C1048 678 1043 683 1032 683C1018 683 970 680 956 680Z"/></g><g data-mml-node="mi" transform="translate(977,-150) scale(0.707)" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></g></svg></mjx-container></span>是相互独立的，由于多个独立事件同时发生的联合概率等于各自概率的乘积，因此在极大后验估计中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="6.156ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2721 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2332,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>就会变成<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="6.896ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 3048 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(\mathbf{W}_i)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{W}_i" transform="translate(1143,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2659,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>的乘积，在取对数后就会变成求和项。</p>
<h2><a id="toc-75e" class="anchor" href="#toc-75e"></a>暂退法（Dropout）</h2><p>本节进一步讨论过拟合的问题。</p>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节教材有一处小瑕疵，在从零开始实现中，定义模型<code>class Net</code>的<code>__init__</code>函数中，没有对线性层初始化，这会导致它使用pytorch默认的<code>nn.init.kaiming_uniform_</code>，而非下面简洁实现的<code>nn.init.normal_</code>，所以两种实现并非完全等价。</p>
</div>
<p>线性模型的泛化性很好，但线性模型没有考虑到特征之间的交互作用，只能表示一小类函数，所以必须引入非线性的激活函数，但这样一来，即使我们有比特征多得多的样本，深度神经网络也有可能过拟合。</p>
<p>上一节已经讨论了，经典泛化理论认为我们应该以简单的模型为目标，并引入了权重衰减，它能够起作用，是因为参数的范数代表了一种有用的简单性度量（基于奥卡姆剃刀，简单模型先验概率大）。简单性的另一个角度是平滑性，即函数不应该对其输入的微小变化敏感，为输入添加随机噪声应该对结果基本无影响。</p>
<p>那么关键的挑战就是如何注入这种噪声，但无论怎么注入噪声，预期都是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.203ex" height="2.265ex" role="img" focusable="false" viewBox="0 -751.2 2299.8 1001.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="E[\mathbf{x}'] = \mathbf{x}"><g data-mml-node="mi" data-latex="E"><path data-c="1D438" d="M199 656C199 646 210 641 231 641C271 641 291 637 291 628C291 625 289 618 286 605L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 49 0 70 0L583 0C607 0 609 2 617 19L657 109C684 171 703 217 714 248C712 257 709 263 698 263C691 263 685 258 681 249C656 190 632 145 608 113C568 59 509 39 415 39L270 39C260 39 253 39 249 40C243 40 240 42 240 45C240 47 242 54 245 67L311 334L406 334C453 334 478 328 483 315C485 310 486 303 486 293C486 280 484 264 479 245C477 240 476 236 476 233C476 223 482 218 493 218C502 218 508 226 512 241L568 473C568 483 563 488 552 488C544 488 538 481 535 467C525 428 512 403 495 391C478 379 450 373 409 373L321 373L379 606C387 640 387 641 429 641L568 641C619 641 654 636 673 626C701 611 715 581 715 536C715 519 714 501 711 484C711 482 711 479 710 475L710 466C710 455 715 450 725 450C735 450 741 459 743 478L763 649C766 677 759 680 732 680L233 680C210 680 199 679 199 656Z"/></g><g data-mml-node="mo" data-latex="[" transform="translate(766,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="msup" transform="translate(1044,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" transform="translate(640,363) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="]" transform="translate(2021.8,0)"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.762ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1662.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="E[\mathbf{x}'] = \mathbf{x}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>：</p>
<ul>
<li>Bishop是将高斯噪声添加到线性模型的输入中，恰好会推导出与<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.528ex" height="1.887ex" role="img" focusable="false" viewBox="0 -684 1117.6 834"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L_2"><g data-mml-node="msub" data-latex="L_2"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mn" transform="translate(714,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>权重衰减相同的形式</li>
<li>标准暂退法正则化中，每个隐藏层以暂退概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="1.138ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 503 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g></g></g></svg></mjx-container></span>随机丢弃一些参数不参与本次训练，剩余参数等比例放大，保持总期望不变：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -2.338ex;" xmlns="http://www.w3.org/2000/svg" width="23.036ex" height="5.807ex" role="img" focusable="false" viewBox="0 -1533.5 10181.7 2566.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned} h' = \begin{cases}   0 &amp; \text{ 概率为 } p \\   \frac{h}{1-p} &amp; \text{ 其他情况} \end{cases} \end{aligned}\end{split} "><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned} h' = \begin{cases}   0 &amp; \text{ 概率为 } p \\   \frac{h}{1-p} &amp; \text{ 其他情况} \end{cases} \end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex=" "><g data-mml-node="mtd"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mo" transform="translate(609,413) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(1224.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mrow" data-latex="{cases}" transform="translate(2280.3,0)"><g data-mml-node="mo"><path data-c="7B" d="M197 250C300 300 425 413 425 549L425 1147C425 1201 446 1253 489 1303C529 1350 576 1382 629 1399C642 1403 648 1411 648 1424C648 1441 639 1450 622 1450C619 1450 617 1450 615 1449C543 1426 479 1389 423 1338C358 1277 325 1214 325 1147L325 549C325 490 305 434 265 381C225 328 177 292 121 275C108 271 102 263 102 250C102 237 108 229 121 225C177 208 225 172 265 119C305 66 325 10 325-49L325-647C325-714 358-777 423-838C479-889 543-926 615-949C617-950 619-950 622-950C639-950 648-941 648-924C648-911 642-903 629-899C576-882 529-850 489-803C446-753 425-701 425-647L425-49C425 87 300 200 197 250Z"/></g><g data-mml-node="mtable" transform="translate(750,0)"><g data-mml-node="mtr" transform="translate(0,783.5)"><g data-mml-node="mtd"><g data-mml-node="mn" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g><g data-mml-node="mtd" transform="translate(2699.4,0)"><g data-mml-node="mtext" data-latex="\text{ 概率为 }"><path data-c="A0" d=""/><text data-variant="normal" transform="translate(332,0) scale(1,-1)" font-size="884px" font-family="serif">概率为</text><path data-c="A0" d="" transform="translate(3332,0)"/></g><g data-mml-node="mi" data-latex="p" transform="translate(3664,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-551.3)"><g data-mml-node="mtd"><g data-mml-node="mfrac" data-latex="\frac{h}{1-p}"><g data-mml-node="mi" transform="translate(646,394) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mrow" transform="translate(220,-345) scale(0.707)" data-latex="1-p"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(500,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="p" transform="translate(1278,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g></g><rect width="1459.4" height="60" x="120" y="220"/></g></g><g data-mml-node="mtd" transform="translate(2699.4,0)"><g data-mml-node="mtext" data-latex="\text{ 其他情况}"><path data-c="A0" d=""/><text data-variant="normal" transform="translate(332,0) scale(1,-1)" font-size="884px" font-family="serif">其他情况</text></g></g></g></g><g data-mml-node="mo" transform="translate(7781.4,0) translate(0 250)"/></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></li>
</ul>
<p><strong>暂退法的这一策略基于这样的朴素想法：暂退法会破坏共适应性，强迫特征具备更强的健壮性。</strong></p>
<p>由此，我们可以对比一下两种防止过拟合的策略，并将损失函数的推导过程也加入对比：</p>
<table>
<thead>
<tr>
<th>方法</th>
<th>应用对象</th>
<th>基本思想</th>
</tr>
</thead>
<tbody><tr>
<td>权重衰减/特征选择</td>
<td>特征<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.009ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.014ex" role="img" focusable="false" viewBox="0 -444 831 448"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w}"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g></g></g></svg></mjx-container></span></td>
<td>基于极大后验估计，注入我们对参数的先验常识（往往更简单）</td>
</tr>
<tr>
<td>输入噪声训练/暂退法</td>
<td>输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>/每一个中间层的输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.446ex" height="1.57ex" role="img" focusable="false" viewBox="0 -694 639 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{h}"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g></g></g></svg></mjx-container></span></td>
<td>增加模型平滑性（输入添加噪声/每个中间层的输出做概率性暂退以破坏共适应性）</td>
</tr>
<tr>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
<tr>
<td>损失函数</td>
<td>标签<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.452ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.457ex" role="img" focusable="false" viewBox="0 -444 607 644"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{y}"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g></g></g></svg></mjx-container></span></td>
<td>基于对观测噪声的假设，应用极大似然估计来推导损失函数</td>
</tr>
</tbody></table>
<p>此外，通过研究习题中的问题，我们还可以得出以下结论：</p>
<ul>
<li>越靠近输出的深层抽象特征层，越适合设置更高的dropout概率，浅层底层特征层适合更低的丢弃率，避免有效基础特征大量丢失</li>
<li>权重dropout相对于标准激活dropout，有明显短板：无法打破神经元协同适应，还会让优化的稳定性变差（梯度方差变大）</li>
<li>标准dropout是在激活函数后dropout而非先dropout再应用激活函数，因为dropout的目的是对隐藏层特征进行随机失活，尽管在ReLU激活下两者数学等价</li>
</ul>
<h2><a id="toc-e82" class="anchor" href="#toc-e82"></a>前向传播、反向传播和计算图</h2><p>本节详细介绍了梯度是怎么计算的。其关键在于：</p>
<ul>
<li>前向传播：在计算目标函数的过程中构建出计算图</li>
<li>反向传播：再通过反向遍历计算图把目标函数对图中涉及到的变量的梯度依次通过链式法则计算出来。</li>
</ul>
<pre class="mermaid">---
config:
  look: handDrawn
---
graph LR
    x[&quot;$$\mathbf{x}$$&quot;] --&gt; mul1((&quot;$$\times$$&quot;))
    W1[&quot;$$\mathbf{W}^{(1)}$$&quot;] --&gt; mul1
    mul1 --&gt; z[&quot;$$\mathbf{z}$$&quot;]
    z --&gt; phi((&quot;$$\phi$$&quot;))
    phi --&gt; h[&quot;$$\mathbf{h}$$&quot;]
    h --&gt; mul2((&quot;$$\times$$&quot;))
    W2[&quot;$$\mathbf{W}^{(2)}$$&quot;] --&gt; mul2
    mul2 --&gt; o[&quot;$$\mathbf{o}$$&quot;]
    o --&gt; loss((&quot;$$l$$&quot;))
    y[&quot;$$y$$&quot;] --&gt; loss
    loss --&gt; L[&quot;$$L$$&quot;]
    L --&gt; add((&quot;$$+$$&quot;))
    add --&gt; J[&quot;$$J$$&quot;]
    
    W1 --&gt; l2((&quot;$$\mathcal{l}_2$$&quot;))
    W2 --&gt; l2
    l2 --&gt; s[&quot;$$s$$&quot;]
    s --&gt; add
    
    %% 普通节点：纯白背景
    classDef white fill:#ffffff,stroke:#333,stroke-width:1.5px,color:#000,font-size:20px
    class x,z,h,o,y,s,L,J white
    
    %% 权重方块：蓝色填充
    classDef weight fill:#66bfff,stroke:#333,stroke-width:1.5px,color:#000,font-size:20px
    class W1,W2 weight
    
    %% 运算圆圈：浅蓝色填充
    classDef op fill:#b2d9ff,stroke:#333,stroke-width:1.5px,color:#000,font-size:20px
    class mul1,phi,mul2,l2,loss,add op</pre><p><strong>用计算机的语言一句话讲反向传播的计算过程</strong>：先把图中所有边反向，然后找目标函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.05ex;" xmlns="http://www.w3.org/2000/svg" width="1.432ex" height="1.595ex" role="img" focusable="false" viewBox="0 -683 633 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="J"><g data-mml-node="mi" data-latex="J"><path data-c="1D43D" d="M633 667C633 678 627 683 615 683C596 683 525 680 506 680L361 683C344 683 336 675 336 659C336 649 349 644 374 644C419 644 446 642 453 637C456 635 457 632 457 627C457 624 456 617 454 607L340 153C324 89 273 8 202 8C157 8 128 25 114 60L120 60C156 60 188 91 188 127C188 158 172 173 141 173C97 173 71 134 71 90C71 20 132-22 205-22C255-22 301-6 344 26C387 58 415 97 427 144L542 606C551 642 555 644 602 644C623 644 633 646 633 667Z"/></g></g></g></svg></mjx-container></span>能够抵达某个参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>的所有路径，每个路径用链式法则一步步求中间变量的梯度并相乘得到对参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>的梯度，最后把所有路径计算出来的梯度求和就是总梯度。</p>
<p><strong>用纯数学简单理解这个思路</strong>：</p>
<ol>
<li>我们希望对自变量求全导数</li>
<li>含有自变量的函数可能有很多，只要有路径能够到达自变量，就要把这条路径计算出的导数加进来</li>
<li>每个路径上做的都是一次复合函数求导</li>
</ol>
<p>值得一提的是，<strong>反向传播的这种计算方式，天然是计算量更小的一种方式，其通过计算量较小的向量-雅可比乘积（VJP）完成梯度计算，而无需构造完整雅可比矩阵，也无需计算雅可比矩阵的乘法</strong>，下面解释一下：</p>
<p>我们考虑多层感知机中的某一层，即一个从<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>维向量映射到<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.986ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 878 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="m"><g data-mml-node="mi" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g></svg></mjx-container></span>向量的函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.249ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 552 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f:\mathbb {R} ^{n}\rightarrow \mathbb {R} ^{m}"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.039ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1785 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f:\mathbb {R} ^{n}\rightarrow \mathbb {R} ^{m}"><g data-mml-node="mo" data-latex=":"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="msup" data-latex="\mathbb {R}^{n}" transform="translate(555.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb {R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.117ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2703.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f:\mathbb {R} ^{n}\rightarrow \mathbb {R} ^{m}"><g data-mml-node="mo" data-latex="\rightarrow"><path data-c="2192" d="M932 234C939 237 943 243 943 250C943 257 939 263 932 266C884 282 839 316 797 368C769 403 750 444 741 491C738 504 730 510 717 510C701 510 693 502 693 485L694 483L694 482C711 395 755 326 828 274L82 274C66 274 58 266 58 250C58 234 66 226 82 226L828 226C755 174 711 105 694 18L694 17L693 15C693-2 701-10 717-10C730-10 738-4 741 9C750 56 769 97 797 132C839 184 884 218 932 234Z"/></g><g data-mml-node="msup" data-latex="\mathbb {R}^{m}" transform="translate(1277.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb {R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g></g></g></svg></mjx-container></span>，其导数是一个雅可比矩阵（分母布局）：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -6.52ex;" xmlns="http://www.w3.org/2000/svg" width="45.618ex" height="14.171ex" role="img" focusable="false" viewBox="0 -3381.9 20163.2 6263.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf {J} ={\begin{bmatrix}{\dfrac {\partial \mathbf {f} }{\partial x_{1}}}&amp;\cdots &amp;{\dfrac {\partial \mathbf {f} }{\partial x_{n}}}\end{bmatrix}}^\top={\begin{bmatrix}{\dfrac {\partial f_{1}}{\partial x_{1}}}&amp;\cdots &amp;{\dfrac {\partial f_{m}}{\partial x_{1}}}\\\vdots &amp;\ddots &amp;\vdots \\{\dfrac {\partial f_{1}}{\partial x_{n}}}&amp;\cdots &amp;{\dfrac {\partial f_{m}}{\partial x_{n}}}\end{bmatrix}}"><g data-mml-node="TeXAtom" data-latex="\mathbf {J}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(871.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="{{bmatrix}}^\top" transform="translate(1927.6,0)"><g data-mml-node="TeXAtom" data-latex="{{bmatrix}}" data-mjx-texclass="ORD"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="5B" d="M448-738L290-738L290 1238L448 1238C468 1238 478 1248 478 1269C478 1290 468 1300 448 1300L230 1300L230-800L448-800C468-800 478-790 478-769C478-753 464-738 448-738Z"/></g><g data-mml-node="mtable" transform="translate(499,0)"><g data-mml-node="mtr" transform="translate(0,-24.1)"><g data-mml-node="mtd"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial \mathbf {f} }{\partial x_{1}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial \mathbf {f} }{\partial x_{1}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial \mathbf {f}" transform="translate(505.8,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf {f}" data-mjx-texclass="ORD" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D41F" d="M437 613C437 655 401 700 323 700C225 700 117 658 117 545L117 444L42 444L42 397L117 397L117 47L48 47L48 0L174 3C212 3 276 3 312 0L312 47L225 47L225 397L340 397L340 444L219 444L219 545C219 655 295 664 320 664C325 664 330 664 337 662C322 651 314 632 314 613C314 570 349 551 375 551C405 551 437 572 437 613Z"/></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{1}" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><rect width="1774.6" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtd" transform="translate(3014.6,0)"><g data-mml-node="mo" data-latex="\cdots"><path data-c="22EF" d="M720 250C720 280 694 303 664 303C633 303 607 280 607 250C607 220 633 197 664 197C694 197 720 220 720 250M444 250C444 280 418 303 388 303C357 303 332 280 332 250C332 220 357 197 388 197C418 197 444 220 444 250M169 250C169 280 143 303 112 303C82 303 56 280 56 250C56 220 82 197 112 197C142 197 169 220 169 250Z"/></g></g><g data-mml-node="mtd" transform="translate(4790.6,0)"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial \mathbf {f} }{\partial x_{n}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial \mathbf {f} }{\partial x_{n}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial \mathbf {f}" transform="translate(541.1,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf {f}" data-mjx-texclass="ORD" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D41F" d="M437 613C437 655 401 700 323 700C225 700 117 658 117 545L117 444L42 444L42 397L117 397L117 47L48 47L48 0L174 3C212 3 276 3 312 0L312 47L225 47L225 397L340 397L340 444L219 444L219 545C219 655 295 664 320 664C325 664 330 664 337 662C322 651 314 632 314 613C314 570 349 551 375 551C405 551 437 572 437 613Z"/></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{n}" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{n}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{n}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g><rect width="1845.3" height="60" x="120" y="220"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(7374.8,0)"><path data-c="5D" d="M51-800L269-800L269 1300L51 1300C31 1300 21 1290 21 1269C21 1248 31 1238 51 1238L209 1238L209-738L51-738C31-738 21-748 21-769C21-790 31-800 51-800Z"/></g></g></g><g data-mml-node="mi" transform="translate(7906.8,1094.9) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(10712.3,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="{{bmatrix}}" data-mjx-texclass="ORD" transform="translate(11768.1,0)"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="23A1" d="M614 1500L321 1500L321 0L387 0L387 1432L614 1432C636 1432 647 1443 647 1466C647 1485 633 1500 614 1500Z" transform="translate(0,1881.9)"/><path data-c="23A3" d="M614 68L387 68L387 1500L321 1500L321 0L614 0C636 0 647 11 647 34C647 53 633 68 614 68Z" transform="translate(0,-2881.9)"/><svg width="667" height="3403.8" y="-1451.9" x="0" viewBox="0 850.9 667 3403.8" xmlns="http://www.w3.org/2000/svg"><path data-c="23A2" d="M321 0L387 0L387 1000L321 1000Z" transform="scale(1,5.106)"/></svg></g><g data-mml-node="mtable" transform="translate(667,0)"><g data-mml-node="mtr" transform="translate(0,1989.9)"><g data-mml-node="mtd" transform="translate(35.4,0)"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial f_{1}}{\partial x_{1}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial f_{1}}{\partial x_{1}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial f_{1}" transform="translate(261,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="f_{1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{1}" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><rect width="1774.6" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtd" transform="translate(3085.3,0)"><g data-mml-node="mo" data-latex="\cdots"><path data-c="22EF" d="M720 250C720 280 694 303 664 303C633 303 607 280 607 250C607 220 633 197 664 197C694 197 720 220 720 250M444 250C444 280 418 303 388 303C357 303 332 280 332 250C332 220 357 197 388 197C418 197 444 220 444 250M169 250C169 280 143 303 112 303C82 303 56 280 56 250C56 220 82 197 112 197C142 197 169 220 169 250Z"/></g></g><g data-mml-node="mtd" transform="translate(4861.3,0)"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial f_{m}}{\partial x_{1}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial f_{m}}{\partial x_{1}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial f_{m}" transform="translate(220,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="f_{m}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{1}" transform="translate(312.6,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><rect width="1959.8" height="60" x="120" y="220"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,3.9)"><g data-mml-node="mtd" transform="translate(933.6,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g><g data-mml-node="mtd" transform="translate(3166.8,0)"><g data-mml-node="mo" data-latex="\ddots"><path data-c="22F1" d="M557 56C557 87 532 112 501 112C469 112 445 88 445 56C445 25 470 0 501 0C533 0 557 24 557 56M169 444C169 474 143 500 113 500C81 500 57 476 57 444C57 413 82 388 113 388C145 388 169 412 169 444M363 250C363 280 337 306 307 306C277 306 251 280 251 250C251 220 277 194 307 194C337 194 363 220 363 250Z"/></g></g><g data-mml-node="mtd" transform="translate(5852.2,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-2038.1)"><g data-mml-node="mtd"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial f_{1}}{\partial x_{n}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial f_{1}}{\partial x_{n}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial f_{1}" transform="translate(296.4,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="f_{1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{n}" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{n}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{n}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g><rect width="1845.3" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtd" transform="translate(3085.3,0)"><g data-mml-node="mo" data-latex="\cdots"><path data-c="22EF" d="M720 250C720 280 694 303 664 303C633 303 607 280 607 250C607 220 633 197 664 197C694 197 720 220 720 250M444 250C444 280 418 303 388 303C357 303 332 280 332 250C332 220 357 197 388 197C418 197 444 220 444 250M169 250C169 280 143 303 112 303C82 303 56 280 56 250C56 220 82 197 112 197C142 197 169 220 169 250Z"/></g></g><g data-mml-node="mtd" transform="translate(4861.3,0)"><g data-mml-node="TeXAtom" data-latex="{\dfrac {\partial f_{m}}{\partial x_{n}}}" data-mjx-texclass="ORD"><g data-mml-node="mstyle" data-latex="\dfrac {\partial f_{m}}{\partial x_{n}}"><g data-mml-node="mfrac"><g data-mml-node="mrow" data-latex="\partial f_{m}" transform="translate(220,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="f_{m}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{m}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\partial x_{n}" transform="translate(277.3,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="x_{n}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{n}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g><rect width="1959.8" height="60" x="120" y="220"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(7728.1,0)"><path data-c="23A4" d="M280 0L346 0L346 1500L53 1500C31 1500 20 1489 20 1466C20 1443 31 1432 53 1432L280 1432Z" transform="translate(0,1881.9)"/><path data-c="23A6" d="M53 0L346 0L346 1500L280 1500L280 68L53 68C31 68 20 57 20 34C20 11 31 0 53 0Z" transform="translate(0,-2881.9)"/><svg width="667" height="3403.8" y="-1451.9" x="0" viewBox="0 850.9 667 3403.8" xmlns="http://www.w3.org/2000/svg"><path data-c="23A5" d="M280 0L346 0L346 1000L280 1000Z" transform="scale(1,5.106)"/></svg></g></g></g></g></g></svg></mjx-container></span></p>
<p>由复合函数的链式求导法则可知，多层神经网络中间层的输出对输入的导数就是多个上述雅可比矩阵的乘积。但是，一个完整的神经网络的总输出和输入并不是都是向量，而是标量（目标函数）和向量（特征），这意味着最终求出来的梯度会是个向量。换句话说，我们想求的是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="12.995ex" height="2.223ex" role="img" focusable="false" viewBox="0 -832.5 5744 982.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v}^\top\mathbf{J_1}\mathbf{J_2}\dots\mathbf{J_L}"><g data-mml-node="msup" data-latex="\mathbf{v}^\top"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mi" transform="translate(640,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_1}" data-mjx-texclass="ORD" transform="translate(1240.1,0)"><g data-mml-node="msub" data-latex="J_1"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="mn" transform="translate(627,-150) scale(0.707)" data-latex="1"><path data-c="1D7CF" d="M494 0L494 47L354 47L354 623C354 645 354 655 328 655C317 655 315 655 306 648C229 591 126 591 105 591L85 591L85 544L105 544C121 544 176 545 235 564L235 47L96 47L96 0C140 3 246 3 295 3C344 3 450 3 494 0Z"/></g></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_2}" data-mjx-texclass="ORD" transform="translate(2323.7,0)"><g data-mml-node="msub" data-latex="J_2"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="mn" transform="translate(627,-150) scale(0.707)" data-latex="2"><path data-c="1D7D0" d="M517 222L470 222C467 202 458 138 444 131C433 125 358 125 342 125L195 125C242 164 294 207 339 240C453 324 517 371 517 466C517 581 413 655 272 655C151 655 57 593 57 503C57 444 105 429 129 429C161 429 201 451 201 501C201 553 159 569 144 573C173 597 211 608 247 608C333 608 379 540 379 465C379 396 341 328 271 257L70 52C57 40 57 38 57 18L57 0L486 0Z"/></g></g></g><g data-mml-node="mo" transform="translate(3574,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_L}" data-mjx-texclass="ORD" transform="translate(4577.6,0)"><g data-mml-node="msub" data-latex="J_L"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="mi" transform="translate(627,-150) scale(0.707)" data-latex="L"><path data-c="1D40B" d="M643 274L596 274C588 205 571 47 392 47L289 47L289 639L424 639L424 686C380 683 271 683 222 683C178 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0L612 0Z"/></g></g></g></g></g></svg></mjx-container></span>（其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 607 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v} = \frac{\partial L}{\partial \mathbf{y}}"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.103ex;" xmlns="http://www.w3.org/2000/svg" width="5.379ex" height="3.14ex" role="img" focusable="false" viewBox="0 -900.3 2377.5 1388"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v} = \frac{\partial L}{\partial \mathbf{y}}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial L}{\partial \mathbf{y}}" transform="translate(1055.8,0)"><g data-mml-node="mrow" transform="translate(220,394) scale(0.707)" data-latex="\partial L"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="L" transform="translate(566,0)"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g><g data-mml-node="mrow" transform="translate(246.2,-346.3) scale(0.707)" data-latex="\partial \mathbf{y}"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(566,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g></g><rect width="1081.8" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>），是向量-雅可比乘积，而不是一个个雅可比矩阵和雅可比矩阵的乘积，这无需矩阵乘法，也并不需要完整构建矩阵（因为可以在实际运算时拆分成多个向量与向量乘积）。</p>
<p>当然，我们的目的是求梯度后做参数更新，所以要在链式求导计算到需要更新参数的那一层时，将这一层输出对输入的求导转为输出对参数的求导。典型地，当这一层参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1189 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W} \in \mathbb{R}^{d \times h}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.957ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3074.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W} \in \mathbb{R}^{d \times h}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{d\times h}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{d\times h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(520,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1298,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></g></svg></mjx-container></span>时，该导数就是一个雅可比张量，最终的梯度就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="17.468ex" height="2.223ex" role="img" focusable="false" viewBox="0 -832.5 7720.9 982.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v}^\top\mathbf{J_1}\mathbf{J_2}\dots\mathbf{J_{L-1}}\mathsf{J_L}"><g data-mml-node="msup" data-latex="\mathbf{v}^\top"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mi" transform="translate(640,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_1}" data-mjx-texclass="ORD" transform="translate(1240.1,0)"><g data-mml-node="msub" data-latex="J_1"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="mn" transform="translate(627,-150) scale(0.707)" data-latex="1"><path data-c="1D7CF" d="M494 0L494 47L354 47L354 623C354 645 354 655 328 655C317 655 315 655 306 648C229 591 126 591 105 591L85 591L85 544L105 544C121 544 176 545 235 564L235 47L96 47L96 0C140 3 246 3 295 3C344 3 450 3 494 0Z"/></g></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_2}" data-mjx-texclass="ORD" transform="translate(2323.7,0)"><g data-mml-node="msub" data-latex="J_2"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="mn" transform="translate(627,-150) scale(0.707)" data-latex="2"><path data-c="1D7D0" d="M517 222L470 222C467 202 458 138 444 131C433 125 358 125 342 125L195 125C242 164 294 207 339 240C453 324 517 371 517 466C517 581 413 655 272 655C151 655 57 593 57 503C57 444 105 429 129 429C161 429 201 451 201 501C201 553 159 569 144 573C173 597 211 608 247 608C333 608 379 540 379 465C379 396 341 328 271 257L70 52C57 40 57 38 57 18L57 0L486 0Z"/></g></g></g><g data-mml-node="mo" transform="translate(3574,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{J_{L-1}}" data-mjx-texclass="ORD" transform="translate(4577.6,0)"><g data-mml-node="msub" data-latex="J_{L-1}"><g data-mml-node="mi" data-latex="J"><path data-c="1D409" d="M527 639L527 686C492 683 407 683 368 683C315 683 217 683 169 686L169 639L310 639L310 149C310 130 310 25 211 25C194 25 161 28 130 42C130 42 176 61 176 114C176 168 133 191 100 191C63 191 23 166 23 114C23 37 102-11 216-11C350-11 446 46 446 150L446 639Z"/></g><g data-mml-node="TeXAtom" transform="translate(627,-150) scale(0.707)" data-latex="{L-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="L"><path data-c="1D40B" d="M643 274L596 274C588 205 571 47 392 47L289 47L289 639L424 639L424 686C380 683 271 683 222 683C178 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0L612 0Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(692,0)"><path data-c="2212" d="M829 250C829 281 798 281 783 281L110 281C95 281 64 281 64 250C64 220 93 220 105 220L788 220C800 220 829 220 829 250Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1586,0)"><path data-c="1D7CF" d="M494 0L494 47L354 47L354 623C354 645 354 655 328 655C317 655 315 655 306 648C229 591 126 591 105 591L85 591L85 544L105 544C121 544 176 545 235 564L235 47L96 47L96 0C140 3 246 3 295 3C344 3 450 3 494 0Z"/></g></g></g></g><g data-mml-node="TeXAtom" data-latex="\mathsf{J_L}" data-mjx-texclass="ORD" transform="translate(6782.7,0)"><g data-mml-node="msub" data-latex="J_L"><g data-mml-node="mi" data-latex="J"><path data-c="1D5A9" d="M388 151L388 694L296 694L296 154C296 85 256 46 185 46C135 46 92 66 57 106L42 21C99-8 156-22 213-22C322-22 388 42 388 151Z"/></g><g data-mml-node="mi" transform="translate(505,-150) scale(0.707)" data-latex="L"><path data-c="1D5AB" d="M94 0L499 0L499 73L233 71L189 71L189 694L94 694Z"/></g></g></g></g></g></svg></mjx-container></span>，但整个过程仍然无需完整构造矩阵（张量）或是执行矩阵（张量）乘法，只需向量-雅可比矩阵（张量）乘积。</p>
<p>让我们再来看看<strong>pytorch中真实的生产环境的计算图是什么样的</strong>：</p>
<details>
<summary>(下图使用本代码生成，点击展开）</summary><pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> torchviz
<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

<span class="hljs-keyword">def</span> <span class="hljs-title function_">l2_penalty</span>(<span class="hljs-params">W1, W2</span>):
    <span class="hljs-keyword">return</span> torch.<span class="hljs-built_in">sum</span>(W1.<span class="hljs-built_in">pow</span>(<span class="hljs-number">2</span>)) + torch.<span class="hljs-built_in">sum</span>(W2.<span class="hljs-built_in">pow</span>(<span class="hljs-number">2</span>)) <span class="hljs-comment"># 为了计算图展示的简洁性，省略常数计算</span>
<span class="hljs-comment"># 为了计算图展示的简洁性，不使用手动实现的损失函数</span>
<span class="hljs-comment"># def cross_entropy(O, y):</span>
<span class="hljs-comment">#     def softmax(X):</span>
<span class="hljs-comment">#         X_exp = torch.exp(X)</span>
<span class="hljs-comment">#         partition = X_exp.sum(1, keepdim=True)</span>
<span class="hljs-comment">#         return X_exp / partition</span>
<span class="hljs-comment">#     y_hat=softmax(O)</span>
<span class="hljs-comment">#     return - torch.log(y_hat[range(len(y_hat)), y])</span>
cross_entropy = nn.CrossEntropyLoss(reduction=<span class="hljs-string">&#x27;none&#x27;</span>)
<span class="hljs-keyword">def</span> <span class="hljs-title function_">relu</span>(<span class="hljs-params">X</span>):
    a = torch.zeros_like(X)
    <span class="hljs-keyword">return</span> torch.<span class="hljs-built_in">max</span>(X, a)
<span class="hljs-keyword">def</span> <span class="hljs-title function_">net</span>(<span class="hljs-params">X</span>):
    X = X.reshape((-<span class="hljs-number">1</span>, num_inputs))
    H = relu(X @ W1)
    <span class="hljs-keyword">return</span> H @ W2

batch_num, num_inputs, num_outputs, num_hiddens = <span class="hljs-number">20</span>, <span class="hljs-number">784</span>, <span class="hljs-number">10</span>, <span class="hljs-number">256</span>

W1 = nn.Parameter(torch.randn(num_inputs, num_hiddens, requires_grad=<span class="hljs-literal">True</span>) * <span class="hljs-number">0.01</span>)
W2 = nn.Parameter(torch.randn(num_hiddens, num_outputs, requires_grad=<span class="hljs-literal">True</span>) * <span class="hljs-number">0.01</span>)

X = torch.randn(batch_num, num_inputs)
y = torch.randint(num_outputs, (batch_num,))

O = net(X)
L = cross_entropy(O, y)
s = l2_penalty(W1, W2)
J = L + s

<span class="hljs-comment"># 因为反向传播完了计算图就会销毁，所以需要retain_graph</span>
<span class="hljs-comment"># 不过这里不进行反向传播也完全可以，因为计算图是前向传播时构建的</span>
J.<span class="hljs-built_in">sum</span>().backward(retain_graph=<span class="hljs-literal">True</span>)

graph = torchviz.make_dot(
    J,
    params={<span class="hljs-string">&quot;W1&quot;</span>: W1, <span class="hljs-string">&quot;W2&quot;</span>: W2},
    show_attrs=<span class="hljs-literal">True</span>,
    show_saved=<span class="hljs-literal">False</span>,
)
graph.graph_attr[<span class="hljs-string">&#x27;rankdir&#x27;</span>] = <span class="hljs-string">&#x27;LR&#x27;</span>
graph.render(<span class="hljs-string">&quot;compute_graph&quot;</span>, <span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;svg&quot;</span>)
</code></pre></details><p class="firekylin-markdown-img-only"><img src="/static/upload/20260717/compute_graph.svg" alt="compute_graph.svg"></p>
<p>在pytorch的计算图中，只有参数、目标值和算子。中间张量值（包括输入张量）会被存放在算子中，这是因为只有在进行算子运算时才需要这些张量。在pytorch中前向传播与反向传播的具体操作如下：</p>
<ul>
<li>按照提供的计算过程一步步计算出目标值，在过程中只要有参与计算的张量的<code>requires_grad=True</code>（例如参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{W}"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>），就会像传染一样，其后的计算就会纳入计算图构建，计算出的中间张量（或目标张量）会写入<code>grad_fn</code>属性，表示计算该张量所需的算子，例如图中的<code>Mm</code>、<code>Pow</code>、<code>Maximum</code>（用于激活函数）、<code>LogSoftmax</code>等算子</li>
<li><code>grad_fn</code>有两个重要属性：<code>grad_fn.saved_tensors</code>表示反向传播计算导数时所需要的张量，<code>grad_fn.next_functions</code>表示要把当前节点计算好的梯度往哪里传，它指向下一个算子</li>
<li><code>grad_fn</code>作为入口函数，在当前算子计算完梯度后，通过<code>grad_fn.next_functions</code>找下一个算子并将梯度传入，下一个算子用上游梯度结合算子自身的导数计算逻辑计算VJP，得到新的梯度，重复以上过程</li>
<li>直到传播到<code>AccumulateGrad</code>算子，这是一个特殊的算子，表示计算图至此已经抵达叶子节点，该算子会将最终梯度写到叶子张量的<code>.grad</code>属性中</li>
</ul>
<p>pytorch为我们把几乎所有常见的运算做好了算子封装，如果想要自己实现，可以通过继承<code>torch.autograd.Function</code>并实现<code>forward</code>和<code>backward</code>两个函数即可，例如下面这个矩阵乘法算子：</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">class</span> <span class="hljs-title class_">MyMatmul</span>(torch.autograd.Function):
<span class="hljs-meta">    @staticmethod</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">ctx, W, X</span>):
        <span class="hljs-comment"># 把反向需要用到的输入存起来</span>
        ctx.save_for_backward(W, X)
        Z = W @ X
        <span class="hljs-comment"># 返回顺序必须和backward的输入顺序一致：Z对应grad_output</span>
        <span class="hljs-keyword">return</span> Z

<span class="hljs-meta">    @staticmethod</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">backward</span>(<span class="hljs-params">ctx, grad_output</span>):
        <span class="hljs-comment"># 取出前向时存的值</span>
        W, X = ctx.saved_tensors
        <span class="hljs-comment"># 链式法则分别求对w和x的梯度</span>
        grad_W = grad_output @ X.T
        grad_X = W.T @ grad_output
        <span class="hljs-comment"># 返回顺序必须和forward的输入顺序一致：W对应grad_W，X对应grad_X</span>
        <span class="hljs-keyword">return</span> grad_W, grad_X
</code></pre><p>使用<code>apply</code>函数即可执行算子计算，例如<code>MyMatmul.apply(X, W1)</code>。</p>
<h2><a id="toc-fd4" class="anchor" href="#toc-fd4"></a>数值稳定性和模型初始化</h2><p>本节介绍数值稳定性的两个重要问题：梯度消失和梯度爆炸。为了解决这两个问题，除了模型的设计（例如非线性激活函数的选择），模型初始化是非常重要的一环。</p>
<p>随机初始化本身是保证在进行优化前打破对称性的关键，以防止模型表达能力受限。</p>
<p>在模型初始化的具体策略方面，教材介绍了一种叫做Xavier初始化的方式：</p>
<p>对于一个线性全连接层输出，假设权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="3.019ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 1334.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w_{ij}"><g data-mml-node="msub" data-latex="w_{ij}"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{i j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(345,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>具有零均值和方差<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="2.28ex" height="1.912ex" role="img" focusable="false" viewBox="0 -833.9 1007.6 844.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sigma^2"><g data-mml-node="msup" data-latex="\sigma^2"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mn" transform="translate(604,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>，输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.141ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 946.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_j"><g data-mml-node="msub" data-latex="x_j"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>具有零均值和方差<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.486ex;" xmlns="http://www.w3.org/2000/svg" width="2.332ex" height="2.373ex" role="img" focusable="false" viewBox="0 -833.9 1030.8 1048.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\gamma^2"><g data-mml-node="msup" data-latex="\gamma^2"><g data-mml-node="mi" data-latex="\gamma"><path data-c="1D6FE" d="M524 378C537 403 543 416 543 417C543 426 538 431 527 431C520 431 515 428 512 422C477 357 436 265 388 146C384 212 371 274 349 331C320 405 275 442 214 442C151 442 96 400 68 361C35 314 18 279 18 257C18 248 26 243 43 243L48 250C65 302 94 335 135 349C163 358 185 363 201 363C305 363 357 281 357 116C357 77 353 45 345 20C311-91 294-162 294-193C294-208 300-215 311-215C323-215 335-194 346-153C363-89 375-32 382 18C385 33 387 46 390 55C426 167 471 275 524 378Z"/></g><g data-mml-node="mn" transform="translate(627.3,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>，可计算出输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.837ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 812 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="o_i"><g data-mml-node="msub" data-latex="o_i"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>的均值是0，方差是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.486ex;" xmlns="http://www.w3.org/2000/svg" width="7.491ex" height="2.373ex" role="img" focusable="false" viewBox="0 -833.9 3311.1 1048.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_\mathrm{in} \sigma^2 \gamma^2"><g data-mml-node="msub" data-latex="n_\mathrm{in}"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(633,-150) scale(0.707)" data-latex="\mathrm{in}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="in"><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(278,0)"/></g></g></g><g data-mml-node="msup" data-latex="\sigma^2" transform="translate(1272.7,0)"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mn" transform="translate(604,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="msup" data-latex="\gamma^2" transform="translate(2280.3,0)"><g data-mml-node="mi" data-latex="\gamma"><path data-c="1D6FE" d="M524 378C537 403 543 416 543 417C543 426 538 431 527 431C520 431 515 428 512 422C477 357 436 265 388 146C384 212 371 274 349 331C320 405 275 442 214 442C151 442 96 400 68 361C35 314 18 279 18 257C18 248 26 243 43 243L48 250C65 302 94 335 135 349C163 358 185 363 201 363C305 363 357 281 357 116C357 77 353 45 345 20C311-91 294-162 294-193C294-208 300-215 311-215C323-215 335-194 346-153C363-89 375-32 382 18C385 33 387 46 390 55C426 167 471 275 524 378Z"/></g><g data-mml-node="mn" transform="translate(627.3,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>。为了数值稳定性，我们希望输出与输入具备同样的均值和方差，因此我们希望<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.159ex" height="2.452ex" role="img" focusable="false" viewBox="0 -833.9 2280.3 1083.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_\mathrm{in} \sigma^2 = 1"><g data-mml-node="msub" data-latex="n_\mathrm{in}"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(633,-150) scale(0.707)" data-latex="\mathrm{in}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="in"><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(278,0)"/></g></g></g><g data-mml-node="msup" data-latex="\sigma^2" transform="translate(1272.7,0)"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mn" transform="translate(604,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_\mathrm{in} \sigma^2 = 1"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>。我们再考虑反向传播，我们也希望梯度方差在反向传播中保持稳定，即上游梯度方差与本层计算出的梯度方差保持一致，经计算可以得出只有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.136ex" height="2.452ex" role="img" focusable="false" viewBox="0 -833.9 2712.3 1083.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_\mathrm{out} \sigma^2 = 1"><g data-mml-node="msub" data-latex="n_\mathrm{out}"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(633,-150) scale(0.707)" data-latex="\mathrm{out}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="out"><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z"/><path data-c="75" d="M267 18C198 18 185 47 185 112L185 442L32 431L32 393C71 393 94 389 100 382C106 375 109 350 109 306L109 159C109 120 112 90 119 67C134 15 189-11 262-11C316-11 357 14 385 65L385-11L535 0L535 38C499 38 478 40 470 46C462 52 458 66 458 89L458 442L306 431L306 393C341 393 362 390 370 384C378 378 382 365 382 342L382 167C382 88 340 18 267 18Z" transform="translate(500,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1056,0)"/></g></g></g><g data-mml-node="msup" data-latex="\sigma^2" transform="translate(1704.8,0)"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mn" transform="translate(604,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_\mathrm{out} \sigma^2 = 1"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>才满足。这样一来就产生了矛盾，前向传播和反向传播数值稳定性所要求的条件不同，不存在一个权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="3.019ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 1334.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w_{ij}"><g data-mml-node="msub" data-latex="w_{ij}"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="TeXAtom" transform="translate(749,-150) scale(0.707)" data-latex="{i j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(345,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>的初始化方法能让它的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="2.28ex" height="1.912ex" role="img" focusable="false" viewBox="0 -833.9 1007.6 844.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sigma^2"><g data-mml-node="msup" data-latex="\sigma^2"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mn" transform="translate(604,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g></g></g></svg></mjx-container></span>同时满足前向与反向的方差条件。</p>
<p>因此Xavier初始化采取了一种折中的方案，让<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.292ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 571 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex=" \sigma = \sqrt{\frac{2}{n_\mathrm{in} + n_\mathrm{out}}}"><g data-mml-node="mi" data-latex="\sigma"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.423ex;" xmlns="http://www.w3.org/2000/svg" width="11.7ex" height="4.21ex" role="img" focusable="false" viewBox="0 -1232.2 5171.3 1861"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex=" \sigma = \sqrt{\frac{2}{n_\mathrm{in} + n_\mathrm{out}}}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msqrt" data-latex="\sqrt{\frac{2}{n_\mathrm{in} + n_\mathrm{out}}}" transform="translate(1055.8,0)"><g data-mml-node="mo" transform="translate(0,22.2)"><path data-c="221A" d="M1015 1105C1018 1116 1020 1123 1020 1126C1020 1142 1012 1150 996 1150C985 1150 976 1140 970 1121L465-483L254 258L108 87L130 67L195 144L422-650C460-650 463-651 471-623Z"/></g><g transform="translate(1020,0)"><g data-mml-node="mfrac" data-latex="\frac{2}{n_\mathrm{in} + n_\mathrm{out}}"><g data-mml-node="mn" transform="translate(1371,394) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mrow" transform="translate(220,-345) scale(0.707)" data-latex="n_\mathrm{in} + n_\mathrm{out}"><g data-mml-node="msub" data-latex="n_\mathrm{in}"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(633,-150) scale(0.707)" data-latex="\mathrm{in}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="in"><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(278,0)"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(1272.7,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="n_\mathrm{out}" transform="translate(2050.7,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(633,-150) scale(0.707)" data-latex="\mathrm{out}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="out"><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z"/><path data-c="75" d="M267 18C198 18 185 47 185 112L185 442L32 431L32 393C71 393 94 389 100 382C106 375 109 350 109 306L109 159C109 120 112 90 119 67C134 15 189-11 262-11C316-11 357 14 385 65L385-11L535 0L535 38C499 38 478 40 470 46C462 52 458 66 458 89L458 442L306 431L306 393C341 393 362 390 370 384C378 378 382 365 382 342L382 167C382 88 340 18 267 18Z" transform="translate(500,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1056,0)"/></g></g></g></g><rect width="2855.5" height="60" x="120" y="220"/></g></g><rect width="3095.5" height="60" x="1020" y="1112.2"/></g></g></g></svg></mjx-container></span>，这在实践中被证明是有效的。它实现了尽可能地让输出的方差不受输入数量的影响，梯度的方差不受输出数量的影响。</p>
<h2><a id="toc-3c3" class="anchor" href="#toc-3c3"></a>环境和分布偏移</h2><p>本节核心讨论训练数据的问题。如果数据本身有偏（与真实环境分布不符，训练集和测试集并不来自同一个分布），对模型的影响很可能是致命的。此外，通过将基于模型的决策引入环境，可能会影响环境，进而破坏模型。</p>
<p>首先是讨论了<strong>三种训练数据中的分布偏移问题</strong>：</p>
<ul>
<li><strong>协变量偏移</strong>：特征的分布与真实不符（例如图片猫狗分类问题现实中新出现的大量二次元猫狗图片），但给定特征依然正确对应标签</li>
<li><strong>标签偏移</strong>：标签的分布与真实不符（例如症状-&gt;疾病诊断中不同疾病的流行率），但给定的标签依然正确对应特征（症状还是对应疾病，但如果训练集中某罕见病的样本很多，稍模糊一些的症状会倾向于预测为样本多的罕见病）</li>
<li><strong>概念偏移</strong>：标签的定义发生变化（例如精神疾病的诊断标准、时尚与复古的定义等）</li>
</ul>
<p>接下来是<strong>怎么进行分布偏移纠正</strong>：</p>
<ul>
<li><strong>协变量偏移纠正</strong>：训练模型用的数据分布，和实际测试时遇到的数据分布不一样，那我们就针对每个样本加权，权重是真实分布与训练数据分布之比<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.02ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 893 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\beta_i \stackrel{\mathrm{def}}{=} \frac{p(\mathbf{x}_i)}{q(\mathbf{x}_i)}"><g data-mml-node="msub" data-latex="\beta_i"><g data-mml-node="mi" data-latex="\beta"><path data-c="1D6FD" d="M427 706C298 706 212 553 182 432L30-178C30-189 35-194 44-194L49-194C56-194 61-191 62-184L126 74C148 16 191-13 255-13C317-13 374 6 425 45C496 98 532 167 532 250C532 317 509 367 463 400C520 435 556 480 569 534C572 547 574 560 574 571C574 654 507 706 427 706M306 399C311 402 329 403 358 403C365 403 371 402 378 401C368 399 359 398 350 398L332 398C321 398 312 398 306 399M148 138C148 154 150 170 154 186L213 426C240 534 312 675 426 675C483 675 511 646 511 589C511 575 509 559 504 540C490 484 464 444 425 421C403 429 381 433 359 433C315 433 270 432 270 396C270 389 273 383 278 379C287 372 310 368 349 368C374 368 399 372 422 380C449 358 463 324 463 278C463 253 459 224 451 193C428 103 360 17 256 17C188 17 148 68 148 138Z"/></g><g data-mml-node="mi" transform="translate(599,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-mjx-texclass="REL" transform="translate(893,0)"/></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.231ex;" xmlns="http://www.w3.org/2000/svg" width="7.338ex" height="3.868ex" role="img" focusable="false" viewBox="0 -1165.5 3243.5 1709.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\beta_i \stackrel{\mathrm{def}}{=} \frac{p(\mathbf{x}_i)}{q(\mathbf{x}_i)}"><g data-mml-node="TeXAtom" data-latex="\mathrel{\mathop{=}\limits^{\mathrm{def}}}" data-mjx-texclass="REL"><g data-mml-node="mover" data-latex="\mathop{=}\limits^{\mathrm{def}}"><g data-mml-node="TeXAtom" data-latex="\limits" data-mjx-texclass="OP" transform="translate(90.8,0)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(0,567) scale(0.707)" data-latex="{\mathrm{def}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathrm{def}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="def"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(556,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(1000,0)"/></g></g></g></g></g><g data-mml-node="mfrac" data-latex="\frac{p(\mathbf{x}_i)}{q(\mathbf{x}_i)}" transform="translate(1237.3,0)"><g data-mml-node="mrow" transform="translate(220,515.4) scale(0.707)" data-latex="p(\mathbf{x}_i)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(892,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1826,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(238,-368.9) scale(0.707)" data-latex="q(\mathbf{x}_i)"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(452,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(841,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1775,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="1766.2" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>，让真实分布里常见的样本权重变大、训练集里泛滥但真实场景少见的样本权重变小（将权重应用到该样本计算出的loss上）。权重的获取方法是：<ul>
<li>抽取训练集和测试集的相同数量的样本数据训练一个二分类器（逻辑回归）来区分一张图是来自训练集还是测试集。注意：这里我们可以使用测试集中的数据的原因是，我们只使用了测试集的特征，并没有使用它的标签，这个二分类器所使用的标签是我们人为构造的（来自训练集还是测试集）。</li>
<li>针对训练集的所有数据用分类器判断样本来自测试集的概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="5.011ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2215 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p(\mathbf{x}_i)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(892,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1826,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，而来自训练集的概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="4.896ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2164 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="q(\mathbf{x}_i)"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(452,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(841,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1775,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.131ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 500 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1-p(\mathbf{x}_i)"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.274ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3215.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1-p(\mathbf{x}_i)"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="p" transform="translate(1000.2,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1503.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(1892.2,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2826.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，从而反推出权重。</li>
<li>这个方法成立的前提是测试集中出现的每个样本，在训练集中都有出现。</li>
</ul>
</li>
<li><strong>标签偏移纠正</strong>：同样采用样本加权的方法，某个标签在真实场景中越常见，权重就越大。权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.02ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 893 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\beta_i \stackrel{\mathrm{def}}{=} \frac{p(y_i)}{q(y_i)}"><g data-mml-node="msub" data-latex="\beta_i"><g data-mml-node="mi" data-latex="\beta"><path data-c="1D6FD" d="M427 706C298 706 212 553 182 432L30-178C30-189 35-194 44-194L49-194C56-194 61-191 62-184L126 74C148 16 191-13 255-13C317-13 374 6 425 45C496 98 532 167 532 250C532 317 509 367 463 400C520 435 556 480 569 534C572 547 574 560 574 571C574 654 507 706 427 706M306 399C311 402 329 403 358 403C365 403 371 402 378 401C368 399 359 398 350 398L332 398C321 398 312 398 306 399M148 138C148 154 150 170 154 186L213 426C240 534 312 675 426 675C483 675 511 646 511 589C511 575 509 559 504 540C490 484 464 444 425 421C403 429 381 433 359 433C315 433 270 432 270 396C270 389 273 383 278 379C287 372 310 368 349 368C374 368 399 372 422 380C449 358 463 324 463 278C463 253 459 224 451 193C428 103 360 17 256 17C188 17 148 68 148 138Z"/></g><g data-mml-node="mi" transform="translate(599,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-mjx-texclass="REL" transform="translate(893,0)"/></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.231ex;" xmlns="http://www.w3.org/2000/svg" width="7.151ex" height="3.868ex" role="img" focusable="false" viewBox="0 -1165.5 3160.8 1709.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\beta_i \stackrel{\mathrm{def}}{=} \frac{p(y_i)}{q(y_i)}"><g data-mml-node="TeXAtom" data-latex="\mathrel{\mathop{=}\limits^{\mathrm{def}}}" data-mjx-texclass="REL"><g data-mml-node="mover" data-latex="\mathop{=}\limits^{\mathrm{def}}"><g data-mml-node="TeXAtom" data-latex="\limits" data-mjx-texclass="OP" transform="translate(90.8,0)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(0,567) scale(0.707)" data-latex="{\mathrm{def}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathrm{def}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="def"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(556,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(1000,0)"/></g></g></g></g></g><g data-mml-node="mfrac" data-latex="\frac{p(y_i)}{q(y_i)}" transform="translate(1237.3,0)"><g data-mml-node="mrow" transform="translate(220,515.4) scale(0.707)" data-latex="p(y_i)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_i" transform="translate(892,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1709,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(238,-368.9) scale(0.707)" data-latex="q(y_i)"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(452,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_i" transform="translate(841,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1658,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="1683.5" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>的获取方法是：<ul>
<li><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="4.631ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2047 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="q(y_i)"><g data-mml-node="mi" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(452,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_i" transform="translate(841,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1658,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>可以直接通过训练集标签分布统计得到，而标签的真实分布<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="4.746ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2098 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p(y_i)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_i" transform="translate(892,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1709,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>无法直接得到。</li>
<li>基于已训练好的在训练集上表现良好的模型，使用验证集（也来自训练分布）计算混淆矩阵<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.602ex" role="img" focusable="false" viewBox="0 -697 831 708"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{C}"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g></g></g></svg></mjx-container></span>，<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.378ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 1051.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_{ij}"><g data-mml-node="msub" data-latex="c_{ij}"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="TeXAtom" transform="translate(466,-150) scale(0.707)" data-latex="{i j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(345,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>表示真实标签为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="0.932ex" height="1.959ex" role="img" focusable="false" viewBox="0 -661 412 866"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="j"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></svg></mjx-container></span>而模型预测为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="1.52ex" role="img" focusable="false" viewBox="0 -661 345 672"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></svg></mjx-container></span>的样本数量所占的比例。由于标签相比特征的量级小了很多，这个矩阵规模不大。</li>
<li>如果标签偏移假设成立（给定类别<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>，特征<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>的分布在训练集和测试集是一样的），那么在相同模型下用验证集（也来自训练分布）和测试集计算出的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.88ex" height="1.602ex" role="img" focusable="false" viewBox="0 -697 831 708"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{C}"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g></g></g></svg></mjx-container></span>就是相同的，于是有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.152ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2719 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{C} p(\mathbf{y}) = \mu(\hat{\mathbf{y}})"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="mi" data-latex="p" transform="translate(831,0)"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1334,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(1723,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2330,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.886ex" height="2.439ex" role="img" focusable="false" viewBox="0 -828 3043.8 1078"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{C} p(\mathbf{y}) = \mu(\hat{\mathbf{y}})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\mu" transform="translate(1055.8,0)"><path data-c="1D707" d="M572 142C572 151 567 156 556 156C548 156 542 149 539 136C519 56 495 16 468 16C451 16 442 30 442 58C442 75 448 109 461 159L489 266C498 302 506 327 512 358L518 386C520 393 521 398 521 400C521 421 510 431 488 431C466 431 452 419 446 394L374 108C374 97 358 77 326 47C304 26 279 16 250 16C204 16 181 43 181 98C181 117 185 144 194 181L236 347C244 378 249 400 251 411C251 432 240 442 218 442C196 442 182 429 175 403L33-169C31-177 30-182 30-185C30-206 41-216 62-216C77-216 89-208 100-193C103-186 120-117 153 14C177-4 208-13 246-13C305-13 344 18 375 54C386 17 419-13 466-13C535-13 556 68 572 142Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1658.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD" transform="translate(2047.8,0)"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2654.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，表示：<code>分类器的犯错模式</code>*<code>测试集的真实标签分布</code>=<code>观测到的模型的平均预测分布</code>。</li>
<li>用测试集跑出平均预测分布<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="4.498ex" height="2.434ex" role="img" focusable="false" viewBox="0 -828 1988 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mu(\hat{\mathbf{y}})"><g data-mml-node="mi" data-latex="\mu"><path data-c="1D707" d="M572 142C572 151 567 156 556 156C548 156 542 149 539 136C519 56 495 16 468 16C451 16 442 30 442 58C442 75 448 109 461 159L489 266C498 302 506 327 512 358L518 386C520 393 521 398 521 400C521 421 510 431 488 431C466 431 452 419 446 394L374 108C374 97 358 77 326 47C304 26 279 16 250 16C204 16 181 43 181 98C181 117 185 144 194 181L236 347C244 378 249 400 251 411C251 432 240 442 218 442C196 442 182 429 175 403L33-169C31-177 30-182 30-185C30-206 41-216 62-216C77-216 89-208 100-193C103-186 120-117 153 14C177-4 208-13 246-13C305-13 344 18 375 54C386 17 419-13 466-13C535-13 556 68 572 142Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(603,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD" transform="translate(992,0)"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1599,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，解出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.271ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1888 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p(\mathbf{y}) = \mathbf{C}^{-1} \mu(\hat{\mathbf{y}})"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD" transform="translate(892,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1499,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="10.999ex" height="2.452ex" role="img" focusable="false" viewBox="0 -833.9 4861.5 1083.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p(\mathbf{y}) = \mathbf{C}^{-1} \mu(\hat{\mathbf{y}})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="\mathbf{C}^{-1}" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(864,363) scale(0.707)" data-latex="{-1}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(778,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="\mu" transform="translate(2873.5,0)"><path data-c="1D707" d="M572 142C572 151 567 156 556 156C548 156 542 149 539 136C519 56 495 16 468 16C451 16 442 30 442 58C442 75 448 109 461 159L489 266C498 302 506 327 512 358L518 386C520 393 521 398 521 400C521 421 510 431 488 431C466 431 452 419 446 394L374 108C374 97 358 77 326 47C304 26 279 16 250 16C204 16 181 43 181 98C181 117 185 144 194 181L236 347C244 378 249 400 251 411C251 432 240 442 218 442C196 442 182 429 175 403L33-169C31-177 30-182 30-185C30-206 41-216 62-216C77-216 89-208 100-193C103-186 120-117 153 14C177-4 208-13 246-13C305-13 344 18 375 54C386 17 419-13 466-13C535-13 556 68 572 142Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3476.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\hat{\mathbf{y}}" data-mjx-texclass="ORD" transform="translate(3865.5,0)"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" transform="translate(303.5,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4472.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>。</li>
<li>基本逻辑可以理解为：用验证集计算出的<code>分类器的犯错模式</code>，再在测试集上反推出<code>测试集的真实标签分布</code>。</li>
</ul>
</li>
<li><strong>概念偏移纠正</strong>：只能从零开始收集新标签和训练，但在实践中极端的偏移是罕见的，通常概念的变化总是缓慢的，因此我们可以使用新数据更新现有的网络权重，而不是从头开始训练。</li>
</ul>
<p>以上为分布变化的理论知识，接下来教材介绍了几种机器学习问题形式化的一些实际问题类型：经典的批量学习、基于预测决策的应用结果来优化模型的在线学习、有限行动下的老虎机问题（在线学习的特例）、环境会记住之前动作的控制类问题、强调如何基于环境而行动的强化学习、会随着时间的推移而发生变化的问题等。</p>
<p>最后还提到了机器学习中的公平、责任和透明度，表达出精度不一定是评估模型好坏的标准，这是因为将预测转化为行动时，我们通常会考虑到各种方式犯错的潜在成本敏感性。另外还提到了“失控反馈循环”现象，我们要避免发生这种预测-决策-环境的这种坏的正向反馈循环。</p>
<h2><a id="toc-0c8" class="anchor" href="#toc-0c8"></a>实战Kaggle比赛：预测房价</h2><p>本节通过一个实际的例子来应用之前学过的知识。本节在实战中应用到了K折交叉验证的技术。</p>
<ul>
<li>通常的训练过程：将数据集拆分成训练集和验证集，用训练集训练、用验证集计算误差，以观察模拟是否会过拟合，选择模型和调整超参数。但是这类粗暴的拆分方法，在数据量小的情况下，受数据划分的运气影响较大。</li>
<li>K折交叉验证：通过多次划分，分别训练模型，对误差结果取平均，避免了评估结果的偶然性与波动。本质上是一种“多次测量取平均”的方法。</li>
</ul>
<h1><a id="toc-c44" class="anchor" href="#toc-c44"></a>深度学习计算</h1><p>本章深入讨论深度学习计算的关键组件：模型构建、参数访问与初始化、设计自定义层和块、将模型读写到磁盘，以及利用GPU实现显著的加速。基本上都是在讲pytorch怎么使用这些深度学习的基本元素。</p>
<h2><a id="toc-4ea" class="anchor" href="#toc-4ea"></a>层和块</h2><p>层就是神经网络中的一层，例如线性层<code>nn.Linear</code>；而块是神经网络中一个或多个层的组合，是一个抽象概念，主要目的是便于组合成一个逻辑结构，以通过简洁的代码实现复杂的神经网络，例如<code>nn.Sequential</code>。</p>
<p><strong>本节主要介绍如何自定义块</strong>。自定义块只需要继承<code>nn.Module</code>，实现<code>__init__</code>和<code>forward</code>即可。由于计算图是前向传播过程中动态生成的，所以<code>forward</code>中是可以执行代码实现控制流的。</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">class</span> <span class="hljs-title class_">MLP</span>(nn.Module):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self</span>):
        <span class="hljs-built_in">super</span>().__init__()
        <span class="hljs-comment"># 层实例直接保存在类实例（self）中，框架会自动注册进self._modules，使得框架可以拿到层的参数</span>
        <span class="hljs-variable language_">self</span>.hidden = nn.Linear(<span class="hljs-number">20</span>, <span class="hljs-number">256</span>)
        <span class="hljs-variable language_">self</span>.out = nn.Linear(<span class="hljs-number">256</span>, <span class="hljs-number">10</span>)

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-variable language_">self</span>.out(nn.functional.relu(<span class="hljs-variable language_">self</span>.hidden(X)))
</code></pre><h2><a id="toc-cf7" class="anchor" href="#toc-cf7"></a>参数管理</h2><p>本节介绍怎么访问参数、初始化参数，以及参数绑定（在多个层间共享参数）。</p>
<p><strong>访问参数</strong>很简单，先直接下标访问到对应层，然后取层的相关参数即可，例如线性层的<code>.weight</code>、<code>.bias</code>。但此时获取的是parameter，可以通过<code>.weight.data</code>获取到普通张量（做运算不会记录计算图，不累积梯度），<code>.weight.grad</code>获取梯度。</p>
<p>通过<code>.named_parameters()</code>可以遍历所有的参数，例如<code>net[0].named_parameters()</code>，返回值是一个由<code>(name, param)</code>组成的Iterator。</p>
<p>可以通过<code>.state_dict()</code>直接获取所有参数组成的dict，其中key的命名方式与<code>.named_parameters()</code>返回的元组中的name是一致的。这让我们可以以一种字符串表达的形式获取参数，例如<code>net.state_dict()[&#39;2.bias&#39;].data</code>。</p>
<p><strong>初始化参数</strong>，我们可以定义一个<code>my_init</code>函数，然后<code>net.apply(my_init)</code>即可。</p>
<p>至于<strong>参数绑定</strong>，我们只需要在定义net时，针对需要共享参数的块，使用相同的<code>nn.Module</code>实例即可。</p>
<h2><a id="toc-380" class="anchor" href="#toc-380"></a>延后初始化</h2><p>所谓延后初始化，就是在没有指定输入维度的情况下先搭建起网络结构，在首次前向传播时初始化，其核心目的是简化开发。</p>
<p>中文版教材中没有介绍pytorch的方法，但实际上是支持的。具体使用如下：</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

net = nn.Sequential(nn.LazyLinear(<span class="hljs-number">256</span>), nn.ReLU(), nn.LazyLinear(<span class="hljs-number">10</span>))
<span class="hljs-built_in">print</span>(net)
X = torch.rand(<span class="hljs-number">100</span>, <span class="hljs-number">20</span>)
net(X)
<span class="hljs-built_in">print</span>(net)

<span class="hljs-comment"># 会得到以下输出</span>
<span class="hljs-comment"># Sequential(</span>
<span class="hljs-comment">#   (0): LazyLinear(in_features=0, out_features=256, bias=True)</span>
<span class="hljs-comment">#   (1): ReLU()</span>
<span class="hljs-comment">#   (2): LazyLinear(in_features=0, out_features=10, bias=True)</span>
<span class="hljs-comment"># )</span>
<span class="hljs-comment"># Sequential(</span>
<span class="hljs-comment">#   (0): Linear(in_features=20, out_features=256, bias=True)</span>
<span class="hljs-comment">#   (1): ReLU()</span>
<span class="hljs-comment">#   (2): Linear(in_features=256, out_features=10, bias=True)</span>
<span class="hljs-comment"># )</span>
</code></pre><p>在使用<code>nn.LazyLinear</code>的情况下，只需要定义输出大小即可，输入可以省略。事实上我们需要省略的其实只有第一层（因为通常只有第一层的输入不知道），但只要把层定义成lazy的，尽管可以通过前面层的输出大小推断出输入大小，也依然会在第一次前向传播时才初始化。</p>
<h2><a id="toc-3eb" class="anchor" href="#toc-3eb"></a>自定义层</h2><p><strong>本节主要介绍如何自定义层</strong>。下面的代码自定义了一个带ReLU的全连接线性层。</p>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>教材中有处错误，<code>forward</code>函数中使用的是参数的<code>.data</code>做计算，这会让前向传播过程无法构建计算图，导致无法反向传播计算梯度。</p>
</div>
<pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> torch.nn.functional <span class="hljs-keyword">as</span> F
<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

<span class="hljs-keyword">class</span> <span class="hljs-title class_">MyLinear</span>(nn.Module):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, in_units, units</span>):
        <span class="hljs-built_in">super</span>().__init__()
        <span class="hljs-variable language_">self</span>.weight = nn.Parameter(torch.randn(in_units, units))
        <span class="hljs-variable language_">self</span>.bias = nn.Parameter(torch.randn(units,))
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X</span>):
        linear = torch.matmul(X, <span class="hljs-variable language_">self</span>.weight) + <span class="hljs-variable language_">self</span>.bias
        <span class="hljs-keyword">return</span> F.relu(linear)
</code></pre><p>另外，pytorch的线性层实现中，参数采用输出通道在前的存储方式，这样性能更好。</p>
<h2><a id="toc-8d1" class="anchor" href="#toc-8d1"></a>读写文件</h2><p>张量读写：</p>
<ul>
<li>写：<code>torch.save(x, &#39;x-file&#39;)</code></li>
<li>读：<code>x2 = torch.load(&#39;x-file&#39;)</code></li>
</ul>
<p>但其实它们也能读写内置类型与张量的组合，甚至模型也可以。但是load归load，想要加载后能正常使用，前提是load的变量所需要的各种定义在代码中都有。张量和pytorch的预定义层都是引入了pytorch就自动有定义了，所以能直接load，但自定义的块和层就不一定了。</p>
<p>所以，对于保存模型的场景，建议是保存参数权重（state_dict），而不保存整个模型。我们可以通过如下代码保存和恢复参数：</p>
<pre><code class="hljs lang-python"><span class="hljs-comment"># 保存</span>
net = MLP()
params = net.state_dict()
torch.save(params, <span class="hljs-string">&#x27;mlp.params&#x27;</span>)

<span class="hljs-comment"># 恢复</span>
params2 = torch.load(<span class="hljs-string">&#x27;mlp.params&#x27;</span>)
net2 = MLP()
net2.load_state_dict(params2)
</code></pre><p>简单来说，就是通过前面介绍的方式，调用模型获取所有参数的方法，然后保存变量；恢复时加载变量，定义好网络，再调用模型的恢复参数的方法。</p>
<h2><a id="gpu" class="anchor" href="#gpu"></a>GPU</h2><p>利用GPU加速计算，其核心是将张量的计算放到显存并利用GPU完成计算操作。但两个张量计算的前提是它们必须在同一个设备上。下面以代码形式整理一下所有常见的操作：</p>
<pre><code class="hljs lang-python"><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

<span class="hljs-comment"># 基本操作：查看GPU的数量</span>
torch.cuda.device_count()
<span class="hljs-comment"># 基本操作：获取device，用于下面的传参；cuda等价于cuda:0</span>
torch.device(<span class="hljs-string">&quot;cpu&quot;</span>), torch.device(<span class="hljs-string">&quot;cuda&quot;</span>), torch.device(<span class="hljs-string">&quot;cuda:1&quot;</span>)
<span class="hljs-comment"># 基本操作：查看张量所在device</span>
X.device

<span class="hljs-comment"># 张量操作：定义张量时指定device</span>
X = torch.ones(<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, device=torch.device(<span class="hljs-string">&quot;cpu&quot;</span>))
<span class="hljs-comment"># 张量操作：转移数据到其他device（不会修改原变量，所以必须赋值）</span>
X = X.to(torch.device(<span class="hljs-string">&quot;cuda&quot;</span>))
X = X.cuda(<span class="hljs-number">0</span>)

net = nn.Sequential(nn.Linear(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>))
<span class="hljs-comment"># 模型操作：将模型参数转移到其他device，原地生效</span>
net.to(torch.device(<span class="hljs-string">&quot;cuda&quot;</span>))
net.cuda()
</code></pre><h1><a id="toc-112" class="anchor" href="#toc-112"></a>卷积神经网络</h1><p>从本章开始，将介绍一些全连接层以外的模型结构。</p>
<h2><a id="toc-201" class="anchor" href="#toc-201"></a>从全连接层到卷积 &amp; 图像卷积</h2><p>卷积层的发明，主要来源于图像领域的机器学习问题。</p>
<p><strong>核心问题</strong>：图像数据过于庞大，不可能用全连接层来实现，过多的参数会导致无法训练</p>
<p><strong>关键思路</strong>：基于图像数据特性和要解决的问题的特性来做简化，减少参数及其计算</p>
<p>具体的特性是：</p>
<ul>
<li><strong>平移不变性</strong>：通常我们针对图像想做的事情是识别，而图像中某一块区域的像素所代表的基本含义在别的位置不会产生变化（例如狗还是狗），即使有变化也是更高级的含义而非基本含义产生变化（高级含义可以后续用其他类型的层来表达）</li>
<li><strong>局部性</strong>：神经网络的前面几层应该只探索输入图像中的局部区域，而不过度在意图像中相隔较远区域的关系，不需要每个像素之间都有参数表达关系</li>
</ul>
<blockquote>
<p>依据一些假设来确定模型/目标函数等机器学习组件设计的过程，我们称之为<strong>归纳偏置</strong>。</p>
</blockquote>
<p>基于这两个朴素的想法，我们想到利用信号处理领域常见的卷积运算来表达。其实我们完全没必要理解数学定义上的卷积，在机器学习领域使用的卷积运算只是采用了类似的思想。严格来讲深度学习所使用的卷积运算实际上叫互相关运算。</p>
<p>卷积层核心做的事情是，针对每个输入像素，使用该像素周围一圈的像素进行加权求和，作为该位置的输出。其中加权的权重叫做卷积核，它同时也决定了周围一圈的像素取多大范围。这个操作本质上类似于滑动加权求和运算。</p>
<p>用数学表达就是：每个输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.138ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2270.9 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[\mathbf{H}]_{i, j}"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="msub" data-latex="]_{i,j}" transform="translate(1178,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i,j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(623,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>的值，等于在输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.068ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2239.9 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[\mathbf{X}]_{i, j}"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="msub" data-latex="]_{i,j}" transform="translate(1147,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i,j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(623,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g></svg></mjx-container></span>周围按卷积核<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="2.038ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 901 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{K}"><g data-mml-node="TeXAtom" data-latex="\mathbf{K}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D40A" d="M852 0L852 47L823 47C770 47 767 51 755 67L485 421L725 621C747 639 789 639 819 639L836 639L836 686C796 683 739 683 734 683C696 683 624 683 588 686L588 639C601 639 621 639 646 634C662 630 650 631 659 628L289 319L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 257L389 340L595 69C600 63 600 61 603 55C585 47 565 47 530 47L530 0C571 3 661 3 706 3C746 3 815 3 852 0Z"/></g></g></g></g></svg></mjx-container></span>大小取元素出来，然后与<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="2.038ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 901 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{K}"><g data-mml-node="TeXAtom" data-latex="\mathbf{K}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D40A" d="M852 0L852 47L823 47C770 47 767 51 755 67L485 421L725 621C747 639 789 639 819 639L836 639L836 686C796 683 739 683 734 683C696 683 624 683 588 686L588 639C601 639 621 639 646 634C662 630 650 631 659 628L289 319L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 257L389 340L595 69C600 63 600 61 603 55C585 47 565 47 530 47L530 0C571 3 661 3 706 3C746 3 815 3 852 0Z"/></g></g></g></g></svg></mjx-container></span>按元素相乘求和。即：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.9ex;" xmlns="http://www.w3.org/2000/svg" width="36.319ex" height="6.874ex" role="img" focusable="false" viewBox="0 -1756.3 16053 3038.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[\mathbf{H}]_{i, j} = u + \sum_{a = -\Delta}^{\Delta} \sum_{b = -\Delta}^{\Delta} [\mathbf{K}]_{a, b}  [\mathbf{X}]_{i+a, j+b}"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="msub" data-latex="]_{i,j}" transform="translate(1178,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i,j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(623,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex="=" transform="translate(2548.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="u" transform="translate(3604.4,0)"><path data-c="1D462" d="M543 144C543 153 538 158 527 158C518 158 513 151 510 137C505 118 500 99 493 80C480 39 462 18 440 18C422 18 413 32 413 60C413 77 420 111 433 161L460 267C469 303 477 328 483 359L489 386C491 393 492 398 492 401C492 421 481 431 459 431C437 431 423 419 417 394L343 98C342 95 338 88 330 76C314 50 275 18 235 18C197 18 178 44 178 95C178 136 196 202 231 294C242 324 248 345 248 357C248 407 213 442 163 442C118 442 83 417 58 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C174 413 181 403 181 384C181 369 175 348 164 319C126 218 107 148 107 111C107 34 155-11 232-11C275-11 314 9 347 50C361 9 391-11 437-11C506-11 527 70 543 144Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(4398.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="munderover" data-latex="\sum_{a=-\Delta}^{\Delta}" transform="translate(5398.9,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(309.7,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1123.3) scale(0.707)" data-latex="{a=-\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(529,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1307,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\Delta" transform="translate(2085,0)"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(737.2,1150) scale(0.707)" data-latex="{\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Delta"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g></g><g data-mml-node="munderover" data-latex="\sum_{b=-\Delta}^{\Delta}" transform="translate(7628.9,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(274.3,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1123.3) scale(0.707)" data-latex="{b=-\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(429,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1207,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\Delta" transform="translate(1985,0)"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(701.8,1150) scale(0.707)" data-latex="{\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Delta"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g></g><g data-mml-node="mo" data-latex="[" transform="translate(9621.5,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{K}" data-mjx-texclass="ORD" transform="translate(9899.5,0)"><g data-mml-node="mi" data-latex="K"><path data-c="1D40A" d="M852 0L852 47L823 47C770 47 767 51 755 67L485 421L725 621C747 639 789 639 819 639L836 639L836 686C796 683 739 683 734 683C696 683 624 683 588 686L588 639C601 639 621 639 646 634C662 630 650 631 659 628L289 319L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 257L389 340L595 69C600 63 600 61 603 55C585 47 565 47 530 47L530 0C571 3 661 3 706 3C746 3 815 3 852 0Z"/></g></g><g data-mml-node="msub" data-latex="]_{a,b}" transform="translate(10800.5,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{a,b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(529,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(807,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g><g data-mml-node="mo" data-latex="[" transform="translate(12035.5,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD" transform="translate(12313.5,0)"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="msub" data-latex="]_{i+a,j+b}" transform="translate(13182.5,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i+a,j+b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(1123,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1652,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1930,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(2342,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(3120,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></g></g></svg></mjx-container></span></p>
<p>但图像每个像素的值并不是一个标量而是一个向量（例如颜色），卷积运算得到的隐藏层输出往往也不是只有一个特征（每个像素周围一圈的像素所组成的图像往往不能用单一的特征来描述，对于每一个空间位置，我们想要采用一组而不是一个隐藏表示）。因此，我们需要在输入中增加一个维度表达不同颜色通道，输出中也增加一个维度表达多个隐藏表示（我们对这两个新增加的维度用通道来称呼）。相应地，卷积核就需要加两个维度。于是，卷积计算将会变成下式：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.9ex;" xmlns="http://www.w3.org/2000/svg" width="39.372ex" height="6.874ex" role="img" focusable="false" viewBox="0 -1756.3 17402.3 3038.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[\mathsf{H}]_{i,j,d} = \sum_{a = -\Delta}^{\Delta} \sum_{b = -\Delta}^{\Delta} \sum_c [\mathsf{K}]_{a, b, c, d} [\mathsf{X}]_{i+a, j+b, c}"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathsf{H}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="H"><path data-c="1D5A7" d="M517 0L613 0L613 694L517 694L517 394L190 394L190 694L94 694L94 0L190 0L190 326L517 326Z"/></g></g><g data-mml-node="msub" data-latex="]_{i,j,d}" transform="translate(986,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i,j,d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(623,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1035,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1313,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g><g data-mml-node="mo" data-latex="=" transform="translate(2920.9,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{a=-\Delta}^{\Delta}" transform="translate(3976.7,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(309.7,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1123.3) scale(0.707)" data-latex="{a=-\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(529,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1307,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\Delta" transform="translate(2085,0)"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(737.2,1150) scale(0.707)" data-latex="{\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Delta"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g></g><g data-mml-node="munderover" data-latex="\sum_{b=-\Delta}^{\Delta}" transform="translate(6206.7,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(274.3,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1123.3) scale(0.707)" data-latex="{b=-\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(429,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1207,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\Delta" transform="translate(1985,0)"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(701.8,1150) scale(0.707)" data-latex="{\Delta}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="\Delta"><path data-c="394" d="M759 0C776 0 785 4 785 13L445 696C438 709 429 716 416 716C403 716 394 709 387 696L52 25C49 18 47 14 47 12C47 4 56 0 73 0M384 604L644 83L124 83Z"/></g></g></g><g data-mml-node="munder" data-latex="\sum_c" transform="translate(8366,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="mi" transform="translate(568.9,-1050) scale(0.707)" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g></g><g data-mml-node="mo" data-latex="[" transform="translate(9810,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathsf{K}" data-mjx-texclass="ORD" transform="translate(10088,0)"><g data-mml-node="mi" data-latex="K"><path data-c="1D5AA" d="M554 0L654 0L374 419L643 694L540 694L188 333L188 694L96 694L96 0L188 0L188 227L314 358Z"/></g></g><g data-mml-node="msub" data-latex="]_{a,b,c,d}" transform="translate(10782,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{a,b,c,d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(529,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(807,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1236,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="c" transform="translate(1514,0)"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1947,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(2225,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g><g data-mml-node="mo" data-latex="[" transform="translate(13084,0)"><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathsf{X}" data-mjx-texclass="ORD" transform="translate(13362,0)"><g data-mml-node="mi" data-latex="X"><path data-c="1D5B7" d="M543 0L656 0L373 366L614 694L510 694L326 439L136 694L24 694L279 366L10 0L115 0L326 300Z"/></g></g><g data-mml-node="msub" data-latex="]_{i+a,j+b,c}" transform="translate(14029,0)"><g data-mml-node="mo" data-latex="]"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g><g data-mml-node="TeXAtom" transform="translate(311,-150) scale(0.707)" data-latex="{i+a,j+b,c}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(1123,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1652,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1930,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(2342,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(3120,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3549,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="c" transform="translate(3827,0)"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g></g></g></g></g></svg></mjx-container></span></p>
<h2><a id="toc-171" class="anchor" href="#toc-171"></a>填充和步幅</h2><p>如果我们按上述定义，输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 869 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg></mjx-container></span>的大小是大于<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="2.036ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 900 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{H}"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g></g></g></svg></mjx-container></span>的（先不考虑通道），因为只要卷积核<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="2.038ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 901 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{K}"><g data-mml-node="TeXAtom" data-latex="\mathbf{K}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="K"><path data-c="1D40A" d="M852 0L852 47L823 47C770 47 767 51 755 67L485 421L725 621C747 639 789 639 819 639L836 639L836 686C796 683 739 683 734 683C696 683 624 683 588 686L588 639C601 639 621 639 646 634C662 630 650 631 659 628L289 319L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 257L389 340L595 69C600 63 600 61 603 55C585 47 565 47 530 47L530 0C571 3 661 3 706 3C746 3 815 3 852 0Z"/></g></g></g></g></svg></mjx-container></span>不是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.131ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 500 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1 \times 1"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1 \times 1"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>，那么在图像边缘部分就涉及到需要对不存在图像的部分做卷积运算的问题，如果忽略这些位置，输出的尺寸就会小于输入。如果我们对输入的边缘做填充（例如填充0），此时输入和输出就应该具有相同大小。因此，<strong>填充可以增加输出的高度和宽度</strong>。</p>
<p>除了填充我们还可以调整步幅。简单来讲步幅就是卷积核所应用到输入上的间距，也就是应用一次卷积核计算出结果后，计算下一个结果时要在输入上横向和纵向移动的距离。前面我们所介绍的都是步幅为1的情况，在应用值为stride的步幅的情况下，我们可以让输出以stride为比例缩减。因此，<strong>步幅可以减小输出的高和宽</strong>。</p>
<p>总的来说，<strong>填充和步幅可用于有效地调整数据的维度</strong>，对于输入尺寸为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.467ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1090.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_h \times n_w"><g data-mml-node="msub" data-latex="n_h"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mi" transform="translate(633,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.954ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2189.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n_h \times n_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="n_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mi" transform="translate(633,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>、卷积核尺寸为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.288ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1011.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k_h \times k_w"><g data-mml-node="msub" data-latex="k_h"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.775ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2110.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k_h \times k_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="k_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>、填充大小为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.247ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 993.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_h \times p_w"><g data-mml-node="msub" data-latex="p_h"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.734ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2092.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_h \times p_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="p_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>（指上下共填充<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="2.247ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 993.3 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_h"><g data-mml-node="msub" data-latex="p_h"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg></mjx-container></span>、左右共填充<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="2.471ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 1092.3 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_w"><g data-mml-node="msub" data-latex="p_w"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>）、步幅大小为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.17ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 959.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="s_h \times s_w"><g data-mml-node="msub" data-latex="s_h"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.657ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2058.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="s_h \times s_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="s_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>的情况，输出形状为：<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.351ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1923.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="\lfloor"><path data-c="230A" d="M393-202L220-202L220 726C220 742 212 750 197 750C182 750 174 742 174 726L174-250L393-250C408-250 416-242 416-226C416-214 405-202 393-202Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(444,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="n_h" transform="translate(833,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mi" transform="translate(633,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.551ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="k_h" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.51ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1993.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="p_h" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="9.619ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4251.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="s_h" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1959.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(2348.5,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="msub" data-latex="s_h" transform="translate(2848.5,0)"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex="\rfloor" transform="translate(3807.8,0)"><path data-c="230B" d="M51-250L270-250L270 726C270 742 262 750 247 750C232 750 224 742 224 726L224-202L51-202C36-202 28-210 28-226C28-242 36-250 51-250Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.838ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3022.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mo" data-latex="\lfloor" transform="translate(1000.2,0)"><path data-c="230A" d="M393-202L220-202L220 726C220 742 212 750 197 750C182 750 174 742 174 726L174-250L393-250C408-250 416-242 416-226C416-214 405-202 393-202Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1444.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="n_w" transform="translate(1833.2,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mi" transform="translate(633,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.775ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2110.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="k_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.734ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2092.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="p_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="10.067ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4449.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\lfloor(n_h-k_h+p_h+s_h)/s_h\rfloor \times \lfloor(n_w-k_w+p_w+s_w)/s_w\rfloor"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="s_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2058.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(2447.5,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="msub" data-latex="s_w" transform="translate(2947.5,0)"><g data-mml-node="mi" data-latex="s"><path data-c="1D460" d="M420 354C420 411 362 442 300 442C237 442 192 423 165 385C142 352 130 322 130 295C130 242 165 208 234 193C263 188 285 181 302 173C323 164 333 147 333 123C333 105 325 85 308 62C287 33 250 18 197 18C143 18 108 33 92 62C124 61 151 87 151 119C151 144 138 157 111 157C75 157 52 124 52 88C52 22 124-11 196-11C271-11 325 11 357 56C384 93 397 126 397 156C397 199 376 231 335 252C304 263 280 270 265 273C230 282 194 285 194 328C194 381 244 413 300 413C342 413 369 400 382 375C360 371 337 352 337 327C337 306 348 295 371 295C402 295 420 323 420 354Z"/></g><g data-mml-node="mi" transform="translate(502,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g><g data-mml-node="mo" data-latex="\rfloor" transform="translate(4005.8,0)"><path data-c="230B" d="M51-250L270-250L270 726C270 742 262 750 247 750C232 750 224 742 224 726L224-202L51-202C36-202 28-210 28-226C28-242 36-250 51-250Z"/></g></g></g></svg></mjx-container></span>。</p>
<p>注意：pytorch中<code>nn.Conv2d</code>传入的<code>padding</code>值是上下或左右各填充的大小，而不是共填充的大小（是上面<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="2.247ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 993.3 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_h"><g data-mml-node="msub" data-latex="p_h"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="2.471ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 1092.3 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_w"><g data-mml-node="msub" data-latex="p_w"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>的一半）。</p>
<h2><a id="toc-a98" class="anchor" href="#toc-a98"></a>多输入多输出通道</h2><p>本节重新讨论通道的问题，在有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.719ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 760 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_i"><g data-mml-node="msub" data-latex="c_i"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="mi" transform="translate(466,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>个输入通道和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="1.943ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 858.9 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_o"><g data-mml-node="msub" data-latex="c_o"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="mi" transform="translate(466,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g></g></svg></mjx-container></span>个输出通道的情况下，卷积核形状是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.943ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 858.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_o\times c_i\times k_h\times k_w"><g data-mml-node="msub" data-latex="c_o"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="mi" transform="translate(466,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.982ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1760.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_o\times c_i\times k_h\times k_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="c_i" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g><g data-mml-node="mi" transform="translate(466,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.551ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2011.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_o\times c_i\times k_h\times k_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="k_h" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.775ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2110.5 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="c_o\times c_i\times k_h\times k_w"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="k_w" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mi" transform="translate(554,-150) scale(0.707)" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></g></svg></mjx-container></span>。</p>
<p>多输入多输出通道下互相关的实际运算逻辑为：针对每个输出通道，获取所有输入通道以对应的卷积核计算出结果并求和。简单讲就是for(每个输出通道)计算sum(每个输入通道对应的卷积结果矩阵）。操作后会将输入通道维度消掉，输出通道维度保留。</p>
<p>特别地，如果是卷积层是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.131ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 500 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1 \times 1"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1 \times 1"><g data-mml-node="mo" data-latex="\times"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>的，相当于我们在每个像素位置应用全连接层（每个像素位置的输入通道数据线性变换成输出通道数据）。</p>
<h2><a id="toc-275" class="anchor" href="#toc-275"></a>汇聚层</h2><p>汇聚层与卷积层类似，做的仍然是互相关运算，但是汇聚层没有参数，所做的事情从卷积层的输入与参数进行按元素相乘并求和，改为了对输入参数求最大值和求平均，分别称为最大汇聚层和平均汇聚层。汇聚层的主要优点之一是减轻卷积层对位置的过度敏感。</p>
<ul>
<li><strong>平均汇聚</strong>：对窗口内所有像素做算术平均，平滑局部特征，弱化高频噪声，能够保留区域的整体信息，对全局均值偏移更不敏感，但会模糊边缘细节</li>
<li><strong>最大汇聚</strong>：取窗口内像素最大值，只保留局部最显著的激活特征，能更好保留纹理、边缘这类关键特征，对特征轻微平移更不敏感，但容易放大噪声、出现过拟合</li>
</ul>
<p>两者优化目标不同：平均汇聚侧重区域整体信息平滑，最大汇聚侧重局部最强特征筛选。</p>
<p>此外，汇聚层的输出通道数与输入通道数相同，也就是说会保留原有的通道，不会像卷积层一样在通道上对输入进行汇总。</p>
<h2><a id="toc-016" class="anchor" href="#toc-016"></a>卷积神经网络（LeNet）</h2><p>本节介绍最早发布的卷积神经网络之一LeNet，它发明于上世纪90年代。其网络结构如下：</p>
<pre><code class="hljs lang-python">net = nn.Sequential(
    nn.Conv2d(1, 6, kernel_size=5, padding=2), nn.Sigmoid(),
    nn.AvgPool2d(kernel_size=2, stride=2),
    nn.Conv2d(6, 16, kernel_size=5), nn.Sigmoid(),
    nn.AvgPool2d(kernel_size=2, stride=2),
    nn.Flatten(),
    nn.Linear(16 * 5 * 5, 120), nn.Sigmoid(),
    nn.Linear(120, 84), nn.Sigmoid(),
    nn.Linear(84, 10)
)
</code></pre><h1><a id="toc-6d4" class="anchor" href="#toc-6d4"></a>现代卷积神经网络</h1><p>本章按时间顺序介绍现代的卷积神经网络架构，这些神经网络是将人类直觉和相关数学见解结合后，经过大量研究试错后的结晶。</p>
<h2><a id="toc-16d" class="anchor" href="#toc-16d"></a>深度卷积神经网络（AlexNet）</h2><p>相比之前盛极一时的特征提取方法，另一组研究人员认为特征本身应该被学习。在合理地复杂性前提下，特征应该由多个共同学习的神经网络层组成，每个层都有可学习的参数。</p>
<p>尽管一直有一群执着的研究者不断钻研，试图学习视觉数据的逐级表征，然而很长一段时间里这些尝试都未有突破。深度卷积神经网络的突破出现在2012年，突破可归因于数据和硬件这两个关键因素。</p>
<details>
<summary>AlexNet相比LeNet，使用了更复杂一些的网络，但基本理念是相似的。它以很大的优势赢得了2012年ImageNet图像识别挑战赛。AlexNet相比LeNet变化如图：</summary><p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/alexnet.svg" alt="alexnet.svg"></p>
</details><h2><a id="toc-d7e" class="anchor" href="#toc-d7e"></a>使用块的网络（VGG）</h2><details>
<summary>VGG将卷积层、非线性激活函数、汇聚层这些常用的层抽象成块，多个这样的块再加上全连接层就构成了VGG网络。</summary><p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/vgg.svg" alt="vgg.svg"></p>
</details><h2><a id="toc-3ee" class="anchor" href="#toc-3ee"></a>网络中的网络（NiN）</h2><p>LeNet、AlexNet和VGG都有一个共同的设计模式：通过一系列的卷积层与汇聚层来提取空间结构特征，然后通过全连接层对特征的表征进行处理。</p>
<details>
<summary>NiN换了一种方式：针对每个像素位置应用一个全连接层。即将空间维度中的每个像素视为单个样本，将通道维度视为不同特征。NiN和AlexNet之间的一个显著区别是NiN完全取消了最后的全连接层，最后一个NiN块的输出通道数等于标签类别的数量，然后放一个全局平均汇聚层直接输出结果。设计影响了许多后续卷积神经网络的设计。</summary><p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/nin.svg" alt="nin.svg"></p>
</details><h2><a id="toc-5fb" class="anchor" href="#toc-5fb"></a>含并行连结的网络（GoogLeNet）</h2><details>
<summary>GoogLeNet吸收了NiN中串联网络的思想，并在此基础上做了改进。它解决了什么样大小的卷积核最合适的问题。GoogLeNet使用不同大小的卷积核组合，通过多个Inception块结构（计算4路不同大小的卷积核组成的卷积层，并在通道维度聚合）的组合，有效地识别不同范围的图像细节。它以较低的计算复杂度提供了类似的测试精度。</summary><p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/inception.svg" alt="inception.svg"> <img src="/static/upload/20260725/inception-full.svg" alt="inception-full.svg"></p>
</details><h2><a id="toc-3ed" class="anchor" href="#toc-3ed"></a>批量规范化</h2><p>训练深层神经网络是十分困难的。批量规范化（Batch Normalization）是一种流行且有效的技术，可持续加速深层网络的收敛速度。再结合后面的残差块，批量规范化使得研究人员能够训练100层以上的网络。</p>
<p>BN层在<strong>训练</strong>时做如下计算：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.125ex;" xmlns="http://www.w3.org/2000/svg" width="26.048ex" height="5.546ex" role="img" focusable="false" viewBox="0 -1512 11513 2451.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathrm{BN}(\mathbf{x}) = \boldsymbol{\gamma} \odot \frac{\mathbf{x} - \hat{\boldsymbol{\mu}}_\mathcal{B}}{\hat{\boldsymbol{\sigma}}_\mathcal{B}} + \boldsymbol{\beta}"><g data-mml-node="TeXAtom" data-latex="\mathrm{BN}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="BN"><path data-c="42" d="M478 358C548 376 624 432 624 512C624 565 599 607 549 640C506 669 456 683 401 683L36 683L36 644L64 644C99 644 120 641 127 636C134 631 138 620 138 602L138 81C138 63 134 51 127 46C120 41 99 39 64 39L36 39L36 0L427 0C484 0 535 16 579 48C627 83 651 129 651 185C651 278 563 342 478 358M521 512C521 428 451 370 367 370L228 370L228 609C228 645 233 644 272 644L394 644C468 644 521 586 521 512M544 186L544 160C542 137 529 111 504 84C478 54 442 39 395 39L272 39C233 39 228 38 228 74L228 340L409 340C490 340 544 270 544 186Z"/><path data-c="4E" d="M576 15C585.6 1 589 0 596 0C613 0 614 7 614 30L614 575C614 592 618 606 626 619C637 636 667 644 716 644L716 683L596 680L477 683L477 644C526 644 556 636 567 619C575 606 579 592 579 575L579 166L237 668C230 678 220 683 205 683L33 683L33 644L66 644C106 644 128 642 133 638C134 637 135 632 135 624L135 108C135 91 131 77 123 64C112 47 82 39 33 39L33 0L152 3L272 0L272 39C223 39 193 47 182 64C174 77 170 91 170 108L170 611Z" transform="translate(708,0)"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1458,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1847,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2454,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3120.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\boldsymbol{\gamma}" transform="translate(4176.6,0)"><path data-c="1D738" d="M617 430C617 444 603 444 594 444C584 444 580 444 575 440C573 438 520 351 449 190C440 257 392 452 237 452C96 452 12 312 12 271C12 256 26 256 35 256C46 256 54 256 59 268C81 332 164 342 216 342C271 342 337 329 371 281C398 241 406 159 406 118C406 78 404 71 397 50C370-31 339-139 339-176C339-184 339-211 363-211C387-211 400-174 404-162C412-138 438-48 450 55C451 67 451 69 454 77C481 152 529 268 600 396C606 407 617 426 617 430Z"/></g><g data-mml-node="mo" data-latex="\odot" transform="translate(5015.8,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\mathbf{x} - \hat{\boldsymbol{\mu}}_\mathcal{B}}{\hat{\boldsymbol{\sigma}}_\mathcal{B}}" transform="translate(6020,0)"><g data-mml-node="mrow" data-latex="\mathbf{x} - \hat{\boldsymbol{\mu}}_\mathcal{B}" transform="translate(220,676)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(829.2,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_\mathcal{B}" transform="translate(1829.4,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="TeXAtom" transform="translate(741,-150.6) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\sigma}}_\mathcal{B}" transform="translate(1145.7,-788)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\sigma}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\sigma}"><path data-c="1D748" d="M671 405C671 444 636 444 618 444L339 444C133 444 42 255 42 151C42 43 123-8 230-8C413-8 519 130 519 272C519 297 515 324 505 348L601 348C620 348 636 348 651 363C658 370 671 382 671 405M411 278C411 248 391 148 359 99C318 37 260 28 232 28C145 28 145 98 145 114C145 152 167 247 190 284C210 318 243 348 319 348C401 348 411 314 411 278Z"/></g><g data-mml-node="mo" transform="translate(343,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="TeXAtom" transform="translate(719,-150.6) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g><rect width="3370.6" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="+" transform="translate(9852.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\boldsymbol{\beta}" transform="translate(10853,0)"><path data-c="1D737" d="M638 566C638 600 628 631 607 654C574 689 522 703 467 703C342 703 225 581 192 448L36-177C35-188 41-194 49-194L68-194C75-194 80-190 82-184L145 70C174 22 228-8 296-8C362-8 431 6 492 46C546 82 584 137 598 194C604 218 608 241 608 264C608 306 597 345 573 375C566 384 558 392 550 399C592 430 621 475 633 522C637 537 638 552 638 566M282 389C282 352 336 348 385 348C420 348 455 353 489 366C500 350 505 325 505 302C505 270 497 235 488 201C477 155 462 108 423 73C388 41 341 28 298 28C222 28 171 81 171 153C171 166 173 180 176 194L238 441C267 557 359 667 465 667C511 667 546 645 546 595C546 574 541 551 535 529C527 495 517 459 492 431C465 440 434 444 403 444C351 444 282 444 282 389M450 399C430 389 408 384 388 384C362 384 328 384 330 393C334 408 371 408 400 408C418 408 435 405 450 399Z"/></g></g></g></svg></mjx-container></span></p>
<p>其中，</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -5.642ex;" xmlns="http://www.w3.org/2000/svg" width="27.33ex" height="12.414ex" role="img" focusable="false" viewBox="0 -2993.6 12079.9 5487.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\hat{\boldsymbol{\mu}}_\mathcal{B} &amp;= \frac{1}{|\mathcal{B}|} \sum_{\mathbf{x} \in \mathcal{B}} \mathbf{x}\\
\hat{\boldsymbol{\sigma}}_\mathcal{B}^2 &amp;= \frac{1}{|\mathcal{B}|} \sum_{\mathbf{x} \in \mathcal{B}} (\mathbf{x} - \hat{\boldsymbol{\mu}}_{\mathcal{B}})^2 + \epsilon
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\hat{\boldsymbol{\mu}}_\mathcal{B} &amp;= \frac{1}{|\mathcal{B}|} \sum_{\mathbf{x} \in \mathcal{B}} \mathbf{x}\\
\hat{\boldsymbol{\sigma}}_\mathcal{B}^2  &amp;= \frac{1}{|\mathcal{B}|} \sum_{\mathbf{x} \in \mathcal{B}} (\mathbf{x} - \hat{\boldsymbol{\mu}}_{\mathcal{B}})^2  + \epsilon
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1651.6)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_\mathcal{B}"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="TeXAtom" transform="translate(741,-150.6) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="mtd" transform="translate(1341.1,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{|\mathcal{B}|}" transform="translate(1333.6,0)"><g data-mml-node="mn" data-latex="1" transform="translate(637,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mrow" data-latex="|\mathcal{B}|" transform="translate(220,-710)"><g data-mml-node="mo" data-latex="|"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{B}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(1056,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g></g><rect width="1534" height="60" x="120" y="220"/></g><g data-mml-node="munder" data-latex="\sum_{\mathbf{x}\in\mathcal{B}}" transform="translate(3274.2,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(3.5,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1121.2) scale(0.707)" data-latex="{\mathbf{x}\in\mathcal{B}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="\in" transform="translate(607,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{B}" data-mjx-texclass="ORD" transform="translate(1274,0)"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(4891.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1242)"><g data-mml-node="mtd" transform="translate(22,0)"><g data-mml-node="msubsup" data-latex="\hat{\boldsymbol{\sigma}}_\mathcal{B}^2"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\sigma}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\sigma}"><path data-c="1D748" d="M671 405C671 444 636 444 618 444L339 444C133 444 42 255 42 151C42 43 123-8 230-8C413-8 519 130 519 272C519 297 515 324 505 348L601 348C620 348 636 348 651 363C658 370 671 382 671 405M411 278C411 248 391 148 359 99C318 37 260 28 232 28C145 28 145 98 145 114C145 152 167 247 190 284C210 318 243 348 319 348C401 348 411 314 411 278Z"/></g><g data-mml-node="mo" transform="translate(343,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mn" transform="translate(719,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="TeXAtom" transform="translate(719,-271.2) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="mtd" transform="translate(1341.1,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{|\mathcal{B}|}" transform="translate(1333.6,0)"><g data-mml-node="mn" data-latex="1" transform="translate(637,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mrow" data-latex="|\mathcal{B}|" transform="translate(220,-710)"><g data-mml-node="mo" data-latex="|"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{B}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(1056,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g></g><rect width="1534" height="60" x="120" y="220"/></g><g data-mml-node="munder" data-latex="\sum_{\mathbf{x}\in\mathcal{B}}" transform="translate(3274.2,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(3.5,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1121.2) scale(0.707)" data-latex="{\mathbf{x}\in\mathcal{B}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="\in" transform="translate(607,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{B}" data-mjx-texclass="ORD" transform="translate(1274,0)"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(4725.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(5114.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(5943.4,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_{\mathcal{B}}" transform="translate(6943.6,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="TeXAtom" transform="translate(741,-150.6) scale(0.707)" data-latex="{\mathcal{B}}" data-mjx-texclass="ORD"><g data-mml-node="TeXAtom" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g><g data-mml-node="msup" data-latex=")^2" transform="translate(8284.8,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mn" transform="translate(422,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="+" transform="translate(9332.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\epsilon" transform="translate(10332.8,0)"><path data-c="1D716" d="M228-11C268-11 305 0 339 22C352 31 358 38 358 43C358 55 353 61 344 61L330 54C293 30 260 18 230 18C163 18 128 72 128 142C128 168 131 195 138 222L296 222C321 222 333 229 333 242C333 254 322 260 301 260L148 260C175 349 229 393 310 393L340 393C364 393 376 400 376 413C376 425 365 431 343 431L309 431C238 431 176 407 124 358C72 309 47 250 47 179C47 71 120-11 228-11Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p><strong>简单来说就是针对一个batch的输入数据中的每一个特征做归一化。</strong></p>
<ul>
<li>线性层：用batch中所有样本计算每个特征的均值和方差然后做归一化</li>
<li>卷积层：类似线性层，但是只把通道作为特征，对所有样本和样本中所有像素位置一起算均值和方差（因为同一通道全部空间像素是同类空间特征，H/W只是位置，不算独立特征）</li>
</ul>
<p>而对于<strong>推理</strong>过程来说，会<strong>使用在训练过程中通过批次间指数加权平均得到的近似的全局均值和方差，对输入做归一化</strong>，进行下一步计算：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.406ex;" xmlns="http://www.w3.org/2000/svg" width="33.935ex" height="5.943ex" role="img" focusable="false" viewBox="0 -1563.3 14999.3 2626.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\hat{\boldsymbol{\mu}}_\text{mov\_new} &amp;= (1-m)\hat{\boldsymbol{\mu}}_\text{mov\_old} + m\hat{\boldsymbol{\mu}}_\mathcal{B}
\\
\hat{\boldsymbol{\sigma}}^2_\text{mov\_new} &amp;= (1-m) \hat{\boldsymbol{\sigma}}^2_\text{mov\_old} + m\hat{\boldsymbol{\sigma}}_\mathcal{B}^2
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\hat{\boldsymbol{\mu}}_\text{mov\_new} &amp;= (1-m)\hat{\boldsymbol{\mu}}_\text{mov\_old} + m\hat{\boldsymbol{\mu}}_\mathcal{B}
\\
\hat{\boldsymbol{\sigma}}^2 _\text{mov\_new} &amp;= (1-m) \hat{\boldsymbol{\sigma}}^2 _\text{mov\_old} + m\hat{\boldsymbol{\sigma}}_\mathcal{B}^2 
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,727.3)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_\text{mov\_new}"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mtext" transform="translate(741,-150) scale(0.707)" data-latex="\text{mov\_new}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(833,0)"/><path data-c="76" d="M388 354C388 349 386 342 382 332L286 91L179 356C175 365 173 370 173 371C173 386 192 393 230 393L230 431L118 428C94 427 61 428 19 431L19 393C75 393 84 395 98 359L240 10C245-4 253-11 264-11C275-11 283-4 288 10L417 329C421 340 425 349 430 357C444 381 470 393 508 393L508 431C475 428 449 427 430 428L341 431L341 393C370 392 388 380 388 354Z" transform="translate(1333,0)"/><path data-c="5F" d="M0-140L333-140L333-100L0-100Z" transform="translate(1861,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(2194,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(2750,0)"/><path data-c="77" d="M620 332C634 371 662 392 703 393L703 431C672 428 646 427 627 428L531 431L531 393C569 392 588 377 588 349C588 345 587 339 584 330L497 89L403 353C400 362 399 367 399 370C399 385 418 393 457 393L457 431L350 428C330 427 299 428 258 431L258 393C293 393 314 388 321 379C324 376 332 359 343 328L262 102L172 354C169 363 167 368 167 370C167 385 187 393 226 393L226 431L114 428L18 431L18 393C67 393 80 394 91 361L216 13C222-3 230-11 240-11C251-11 259-4 264 11L360 279L457 10C462-4 470-11 481-11C488-10 496-3 504 10Z" transform="translate(3194,0)"/></g></g></g><g data-mml-node="mtd" transform="translate(3560,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1333.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1722.6,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(2444.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(3445,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(4323,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_\text{mov\_old}" transform="translate(4712,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mtext" transform="translate(741,-150) scale(0.707)" data-latex="\text{mov\_old}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(833,0)"/><path data-c="76" d="M388 354C388 349 386 342 382 332L286 91L179 356C175 365 173 370 173 371C173 386 192 393 230 393L230 431L118 428C94 427 61 428 19 431L19 393C75 393 84 395 98 359L240 10C245-4 253-11 264-11C275-11 283-4 288 10L417 329C421 340 425 349 430 357C444 381 470 393 508 393L508 431C475 428 449 427 430 428L341 431L341 393C370 392 388 380 388 354Z" transform="translate(1333,0)"/><path data-c="5F" d="M0-140L333-140L333-100L0-100Z" transform="translate(1861,0)"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(2194,0)"/><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(2694,0)"/><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z" transform="translate(2972,0)"/></g></g><g data-mml-node="mo" data-latex="+" transform="translate(8219.9,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(9220.1,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msub" data-latex="\hat{\boldsymbol{\mu}}_\mathcal{B}" transform="translate(10098.1,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\mu}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\mu}"><path data-c="1D741" d="M674 148C674 162 659 162 650 162C639 162 635 162 630 157C628 155 628 153 622 128C602 48 579 28 554 28C543 28 531 32 531 65C531 82 535 98 545 138L593 330C599 353 609 393 609 400C609 421 593 444 562 444C542 444 507 432 496 391L427 114C423 96 406 79 388 64C356 37 326 28 299 28C231 28 225 77 225 107C225 134 231 158 235 176L275 332C281 358 292 401 292 408C292 429 276 452 245 452C193 452 180 402 177 390L44-141C40-157 40-163 40-167C40-199 66-211 87-211C106-211 133-200 147-172C153-160 186-23 193 8C234-8 279-8 292-8C326-8 372-2 432 52C456 6 512-8 549-8C586-8 615 13 636 49C661 89 674 143 674 148Z"/></g><g data-mml-node="mo" transform="translate(396,42) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="TeXAtom" transform="translate(741,-150.6) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-706.6)"><g data-mml-node="mtd" transform="translate(22,0)"><g data-mml-node="msubsup" data-latex="\hat{\boldsymbol{\sigma}}^2_\text{mov\_new}"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\sigma}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\sigma}"><path data-c="1D748" d="M671 405C671 444 636 444 618 444L339 444C133 444 42 255 42 151C42 43 123-8 230-8C413-8 519 130 519 272C519 297 515 324 505 348L601 348C620 348 636 348 651 363C658 370 671 382 671 405M411 278C411 248 391 148 359 99C318 37 260 28 232 28C145 28 145 98 145 114C145 152 167 247 190 284C210 318 243 348 319 348C401 348 411 314 411 278Z"/></g><g data-mml-node="mo" transform="translate(343,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mn" transform="translate(719,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mtext" transform="translate(719,-247) scale(0.707)" data-latex="\text{mov\_new}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(833,0)"/><path data-c="76" d="M388 354C388 349 386 342 382 332L286 91L179 356C175 365 173 370 173 371C173 386 192 393 230 393L230 431L118 428C94 427 61 428 19 431L19 393C75 393 84 395 98 359L240 10C245-4 253-11 264-11C275-11 283-4 288 10L417 329C421 340 425 349 430 357C444 381 470 393 508 393L508 431C475 428 449 427 430 428L341 431L341 393C370 392 388 380 388 354Z" transform="translate(1333,0)"/><path data-c="5F" d="M0-140L333-140L333-100L0-100Z" transform="translate(1861,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(2194,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(2750,0)"/><path data-c="77" d="M620 332C634 371 662 392 703 393L703 431C672 428 646 427 627 428L531 431L531 393C569 392 588 377 588 349C588 345 587 339 584 330L497 89L403 353C400 362 399 367 399 370C399 385 418 393 457 393L457 431L350 428C330 427 299 428 258 431L258 393C293 393 314 388 321 379C324 376 332 359 343 328L262 102L172 354C169 363 167 368 167 370C167 385 187 393 226 393L226 431L114 428L18 431L18 393C67 393 80 394 91 361L216 13C222-3 230-11 240-11C251-11 259-4 264 11L360 279L457 10C462-4 470-11 481-11C488-10 496-3 504 10Z" transform="translate(3194,0)"/></g></g></g><g data-mml-node="mtd" transform="translate(3560,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1333.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1722.6,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(2444.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(3445,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(4323,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msubsup" data-latex="\hat{\boldsymbol{\sigma}}^2_\text{mov\_old}" transform="translate(4712,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\sigma}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\sigma}"><path data-c="1D748" d="M671 405C671 444 636 444 618 444L339 444C133 444 42 255 42 151C42 43 123-8 230-8C413-8 519 130 519 272C519 297 515 324 505 348L601 348C620 348 636 348 651 363C658 370 671 382 671 405M411 278C411 248 391 148 359 99C318 37 260 28 232 28C145 28 145 98 145 114C145 152 167 247 190 284C210 318 243 348 319 348C401 348 411 314 411 278Z"/></g><g data-mml-node="mo" transform="translate(343,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mn" transform="translate(719,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mtext" transform="translate(719,-257.7) scale(0.707)" data-latex="\text{mov\_old}"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(833,0)"/><path data-c="76" d="M388 354C388 349 386 342 382 332L286 91L179 356C175 365 173 370 173 371C173 386 192 393 230 393L230 431L118 428C94 427 61 428 19 431L19 393C75 393 84 395 98 359L240 10C245-4 253-11 264-11C275-11 283-4 288 10L417 329C421 340 425 349 430 357C444 381 470 393 508 393L508 431C475 428 449 427 430 428L341 431L341 393C370 392 388 380 388 354Z" transform="translate(1333,0)"/><path data-c="5F" d="M0-140L333-140L333-100L0-100Z" transform="translate(1861,0)"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(2194,0)"/><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(2694,0)"/><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z" transform="translate(2972,0)"/></g></g><g data-mml-node="mo" data-latex="+" transform="translate(8197.9,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="m" transform="translate(9198.1,0)"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="msubsup" data-latex="\hat{\boldsymbol{\sigma}}_\mathcal{B}^2" transform="translate(10076.1,0)"><g data-mml-node="TeXAtom" data-latex="\hat{\boldsymbol{\sigma}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="\boldsymbol{\sigma}"><path data-c="1D748" d="M671 405C671 444 636 444 618 444L339 444C133 444 42 255 42 151C42 43 123-8 230-8C413-8 519 130 519 272C519 297 515 324 505 348L601 348C620 348 636 348 651 363C658 370 671 382 671 405M411 278C411 248 391 148 359 99C318 37 260 28 232 28C145 28 145 98 145 114C145 152 167 247 190 284C210 318 243 348 319 348C401 348 411 314 411 278Z"/></g><g data-mml-node="mo" transform="translate(343,34) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mn" transform="translate(719,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="TeXAtom" transform="translate(719,-271.2) scale(0.707)" data-latex="\mathcal{B}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="B"><path data-c="42" d="M577 388L577 390C666 433 719 487 734 551C737 562 738 572 738 581C738 602 732 620 720 635C703 658 668 672 614 678C592 681 552 682 494 682L498 703L487 713L418 680C331 667 258 638 201 592C158 558 131 520 121 478C114 450 116 431 125 420C129 412 135 408 144 408C175 408 194 425 203 458C204 461 204 470 204 486L207 518C213 540 230 562 257 583C300 617 350 637 407 644L335 357C318 289 299 235 280 194C246 122 179 59 82 59L36-1L311-1C424-1 536 42 601 95C672 152 707 211 707 273C707 354 655 372 577 388M641 607C651 594 656 578 656 559C656 549 654 538 651 526C631 445 535 390 440 390C430 390 420 391 422 400L485 648C569 648 621 634 641 607M603 319C616 302 623 281 623 258C623 247 621 234 618 221C607 173 582 133 545 100C501 62 441 58 362 58L202 58L201 61C251 92 295 135 333 192C354 222 379 276 408 353C437 356 458 357 472 357C539 357 582 344 603 319Z"/></g></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>BN层通常加在激活函数前。实践表明：加BN后损失下降更平稳、梯度不会剧烈震荡、能开更大学习率。2018年后续研究证明BN真正价值是平滑优化损失曲面，而非稳定层内分布。</p>
<h2><a id="toc-958" class="anchor" href="#toc-958"></a>残差网络（ResNet）</h2><p>批量规范化解决了深层神经网络收敛速度的问题，但它只能缓解，最根本的还是模型本身的设计。ResNet通过残差块的设计在该问题上取得了质的突破，对如何建立深层神经网络产生了深远的影响。</p>
<p><strong>ResNet的核心思想源于这样的思考</strong>：当我们要添加一层新网络，如果新增层可以被训练成恒等映射<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.382ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1937 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x}"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(941,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1548,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.762ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1662.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>，那么新网络的输出完全等于旧网络，效果不会变差，至少和原模型一样强。</p>
<p>简单来说就是：给网络加深时，只要新增层能学习 “什么都不做”，加深网络就不会带来性能退化，深层网络理论上一定不差于浅层。</p>
<p>然而，深层网络堆叠几十上百层后，优化器很难找到一组权重，让多层叠加后抵消所有变换。<strong>ResNet采用残差结构，将学习目标改为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.382ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1937 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(941,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1548,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.762ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1662.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.476ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2862.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="g" transform="translate(1000.2,0)"><path data-c="1D454" d="M15-141C15-184 60-205 150-205C197-205 241-193 280-170C324-144 351-109 362-66L471 373C473 383 474 389 474 392C474 412 463 422 442 422C420 422 406 410 399 387C377 424 347 442 310 442C246 442 189 410 140 346C95 286 72 223 72 158C72 71 123-3 207-3C246-3 282 14 315 47L285-71C256-140 211-175 148-175C122-175 100-173 82-169C103-158 113-141 113-118C113-93 99-80 72-80C40-80 15-109 15-141M356 392C376 371 386 351 386 331C386 330 385 325 383 318L336 129C330 106 313 82 286 60C259 38 233 27 210 27C170 27 150 56 150 114C150 169 184 291 204 327C235 384 270 412 311 412C329 412 344 405 356 392Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1477.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1866.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2473.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，强制让恒等映射成为简单解</strong>。此时模型只需要让残差分支<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.213ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1862 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="g(\mathbf{x})=0"><g data-mml-node="mi" data-latex="g"><path data-c="1D454" d="M15-141C15-184 60-205 150-205C197-205 241-193 280-170C324-144 351-109 362-66L471 373C473 383 474 389 474 392C474 412 463 422 442 422C420 422 406 410 399 387C377 424 347 442 310 442C246 442 189 410 140 346C95 286 72 223 72 158C72 71 123-3 207-3C246-3 282 14 315 47L285-71C256-140 211-175 148-175C122-175 100-173 82-169C103-158 113-141 113-118C113-93 99-80 72-80C40-80 15-109 15-141M356 392C376 371 386 351 386 331C386 330 385 325 383 318L336 129C330 106 313 82 286 60C259 38 233 27 210 27C170 27 150 56 150 114C150 169 184 291 204 327C235 384 270 412 311 412C329 412 344 405 356 392Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(477,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(866,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1473,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="g(\mathbf{x})=0"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="0" transform="translate(1055.8,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g></g></svg></mjx-container></span>就能满足<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.382ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1937 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x}"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(941,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1548,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.762ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1662.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>。无论叠加多少残差块，每个残差块都可以选择输出0，整体网络等价于浅层模型，所以只会更好不会更差。</p>
<p>残差块示意图：</p>
<p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/residual-block.svg" alt="residual-block.svg"></p>
<h2><a id="toc-1e0" class="anchor" href="#toc-1e0"></a>稠密连接网络（DenseNet）</h2><p>DenseNet在某种程度上是ResNet的逻辑扩展。在跨层连接上，不同于ResNet中将输入与输出相加，DenseNet在通道维上连结输入与输出。<strong>稠密块中每一层都连接在它前面的所有层的输出。</strong></p>
<p>以泰勒展开式做类比，ResNet中通过<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.382ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1937 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(941,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1548,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.762ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1662.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.476ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2862.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{x}) = \mathbf{x} + g(\mathbf{x})"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="g" transform="translate(1000.2,0)"><path data-c="1D454" d="M15-141C15-184 60-205 150-205C197-205 241-193 280-170C324-144 351-109 362-66L471 373C473 383 474 389 474 392C474 412 463 422 442 422C420 422 406 410 399 387C377 424 347 442 310 442C246 442 189 410 140 346C95 286 72 223 72 158C72 71 123-3 207-3C246-3 282 14 315 47L285-71C256-140 211-175 148-175C122-175 100-173 82-169C103-158 113-141 113-118C113-93 99-80 72-80C40-80 15-109 15-141M356 392C376 371 386 351 386 331C386 330 385 325 383 318L336 129C330 106 313 82 286 60C259 38 233 27 210 27C170 27 150 56 150 114C150 169 184 291 204 327C235 384 270 412 311 412C329 412 344 405 356 392Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1477.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1866.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2473.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>将<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.249ex" height="2.059ex" role="img" focusable="false" viewBox="0 -705 552 910"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg></mjx-container></span>分解为两部分：一个简单的线性项和一个复杂的非线性项。DenseNet则是把这个分解做得更彻底，将块中所有的输出都作为输入传递给后面的层，具体的方法是直接使用<code>torch.cat</code>。</p>
<p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/densenet-block.svg" alt="densenet-block.svg"></p>
<p>相比ResNet，DenseNet这样做的好处是拓宽了特征存储与复用的上限（而不是只能用上一层的输入），并且能使用到块中前面每个层的原始输出（而不是上一层输出与输入混合后的结果）。</p>
<p>此外，<strong>DenseNet没有改变ResNet让恒等映射成为简单解的性质</strong>。DenseNet新增层只需要把自身卷积权重、偏置全部训练为0，输出一组全零特征通道拼接在原有特征后方，即可使得函数性质不变。这是因为全零通道不携带任何有效信息，下游所有运算结果和完全没有这一层时完全一致，因此拥有和ResNet一样的“新增网络层不会导致性能退化”的保底能力。通道数量只是存储空间维度，携带全零的额外通道不会改变网络任何输出结果。</p>
<h1><a id="toc-aad" class="anchor" href="#toc-aad"></a>循环神经网络</h1><p>本章介绍的循环神经网络（recurrent neural network，RNN），主要服务于序列信息处理。循环神经网络通过引入状态变量存储过去的信息和当前的输入来预测当前的输出。</p>
<h2><a id="toc-66c" class="anchor" href="#toc-66c"></a>序列模型</h2><p>前面学习了数值预测、分类预测、图像分类预测等问题的建模方法，现在讨论序列模型。时间序列、文本序列都属于序列，序列模型解决的就是这些序列的预测问题。</p>
<p><strong>序列模型的数学本质是对序列的联合概率分布建模</strong>，标准数学定义是：输入任意长度序列<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="13.718ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6063.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[x_1, x_2, \ldots, x_T]"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(278,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1286.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(1731.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2739.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(3184.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(4188.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4632.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="]" transform="translate(5785.6,0)"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g></g></g></svg></mjx-container></span>，输出这个序列的联合概率分布，也就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="15.927ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 7039.6 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, x_2, \ldots, x_T)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(2596.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3604.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(4049.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(5053.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(5497.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6650.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>。</p>
<p>如果我们有了这样的一个模型，能够知道任意序列的联合概率分布，我们就可以通过该模型做预测：给定<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="15.763ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 6967.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="[x_1, x_2, \ldots, x_{T-1}]"><g data-mml-node="mo" data-latex="["><path data-c="5B" d="M233-202L159-202L159 702L233 702C248 702 256 710 256 726C256 742 248 750 233 750L114 750L114-250L233-250C248-250 256-242 256-226C256-214 245-202 233-202Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(278,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1286.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(1731.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2739.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(3184.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(4188.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{T-1}" transform="translate(4632.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="]" transform="translate(6689.3,0)"><path data-c="5D" d="M45-250L164-250L164 750L45 750C30 750 22 742 22 726C22 710 30 702 45 702L119 702L119-202L45-202C30-202 22-210 22-226C22-242 30-250 45-250Z"/></g></g></g></svg></mjx-container></span>，寻找使得<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="21.585ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 9540.7 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, x_2, \ldots, x_{T-1}, x_T)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(2596.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3604.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(4049.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(5053.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{T-1}" transform="translate(5497.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(7554.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(7998.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(9151.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>最大的那个<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.339ex;" xmlns="http://www.w3.org/2000/svg" width="2.608ex" height="1.339ex" role="img" focusable="false" viewBox="0 -442 1152.8 592"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_T"><g data-mml-node="msub" data-latex="x_T"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g></svg></mjx-container></span>即可。</p>
<p><strong>但在实际的训练和推理中，我们不会直接预测<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="15.927ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 7039.6 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, x_2, \ldots, x_T)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(2596.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3604.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(4049.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(5053.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(5497.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6650.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，而是预测条件概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.645ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2053.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid x_1, \ldots, x_{t-1})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="12.806ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 5660.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid x_1, \ldots, x_{t-1})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1564.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2009,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3012.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{t-1}" transform="translate(3457.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5271.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></strong>。这是因为，根据概率链式法则，联合概率可以拆解成条件概率乘积：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -4.213ex;" xmlns="http://www.w3.org/2000/svg" width="65.481ex" height="9.558ex" role="img" focusable="false" viewBox="0 -2362.2 28942.6 4224.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
P(x_1, x_2, \ldots, x_T) &amp;= P(x_1) P(x_2|x_1) P(x_3|x_1,x_2) \ldots P(x_T|x_1,...,x_{T-1}) \\
&amp;= \prod_{t=1}^T P(x_t \mid x_1, \ldots, x_{t-1})
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
P(x_1 , x_2 , \ldots, x_T) &amp;= P(x_1 ) P(x_2 |x_1 ) P(x_3 |x_1 ,x_2 ) \ldots P(x_T|x_1 ,...,x_{T-1}) \\
&amp;= \prod_{t=1}^T P(x_t \mid x_1 , \ldots, x_{t-1})
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1612.2)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(2596.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3604.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(4049.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(5053.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(5497.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6650.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(7039.6,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(1333.6,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2087.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(2476.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3485.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(3874.1,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4628.1,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(5017.1,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(6025.7,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(6303.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7312.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(7701.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(8455.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(8844.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(9852.8,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(10130.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(11139.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(11584,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12592.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(13148.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(14151.9,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(14905.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(15294.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(16447.7,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(16725.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(17734.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(18178.9,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(18456.9,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="." transform="translate(18734.9,0)"><path data-c="2E" d="M192 53C192 82 168 106 139 106C110 106 86 82 86 53C86 24 110 0 139 0C168 0 192 24 192 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(19012.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{T-1}" transform="translate(19457.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(21514.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-666.5)"><g data-mml-node="mtd" transform="translate(7039.6,0)"/><g data-mml-node="mtd" transform="translate(7039.6,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=1}^T" transform="translate(1333.6,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(390.1,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(2778.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3532.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(3921.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(5109.3,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(5665,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(6673.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(7118.3,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(8121.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{t-1}" transform="translate(8566.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(10380.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>于是问题被转化为条件概率：</p>
<ul>
<li>对于训练来说：对每个位置最大化条件概率，等价于最大化整条序列的联合概率</li>
<li>对于推理来说：我们真正需要的是用条件概率逐步构造出完整序列，而不是求整条序列的联合概率</li>
</ul>
<p>为了训练这样的模型，我们还需要一些<strong>统计工具</strong>，这是因为，随着数据的积累，输入序列长度会不断增加，我们需要一个近似方法来使这个计算变得容易处理。常见的策略有：</p>
<ul>
<li><strong>自回归模型</strong>：假设我们不需要完整序列，只需要最近长度为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.027ex;" xmlns="http://www.w3.org/2000/svg" width="1.156ex" height="1.002ex" role="img" focusable="false" viewBox="0 -431 511 443"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\tau"><g data-mml-node="mi" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g></g></svg></mjx-container></span>的时间跨度的序列数据。特别地，如果这种假设是近似精确的，我们就称序列满足马尔可夫条件，如果<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.156ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 511 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\tau = 1"><g data-mml-node="mi" data-latex="\tau"><path data-c="1D70F" d="M468 431L192 431C139 431 91 397 47 330C34 310 27 297 27 292C30 284 31 279 43 279C50 279 56 283 62 292C94 341 134 366 183 366L260 366L165 56C158 34 155 21 155 18C155-2 166-12 187-12C198-12 208-9 214-3C227 9 228 12 232 33L297 366L459 366C494 366 511 378 511 403C511 426 493 431 468 431Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.52ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1555.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\tau = 1"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>，我们称之为<strong>一阶马尔可夫模型</strong>。</li>
<li><strong>隐变量自回归模型</strong>：保留并持续更新对历史序列的总结<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.068ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 914.3 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t"><g data-mml-node="msub" data-latex="h_t"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>，并以此来估计<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.059ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 910.3 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_t"><g data-mml-node="msub" data-latex="x_t"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>。</li>
</ul>
<p>需要说明的是，以上策略都建立在一个假设之上：尽管随时间推移具体的观测值会不断发生变化，但支配整个序列生成和演化规律的底层物理或统计学规律（即系统动力学）保持不变。否则我们得到的模型也只能描述过去已知序列，不能预测未来。</p>
<p>随着我们对预测时间的增加，会造成误差的快速累积和预测质量的极速下降，这是序列预测的一个重大挑战。</p>
<h2><a id="toc-33f" class="anchor" href="#toc-33f"></a>文本预处理</h2><p>文本是序列数据的一种最常见的形式之一。本节基于一些语料库，展示如何针对文本数据做预处理，以将其组织成文本序列。</p>
<p>简单来讲就是将文本拆分为词元，构建词表将词元字符串映射为数字索引，并将文本数据转换为词元索引以供模型操作。</p>
<h2><a id="toc-a4e" class="anchor" href="#toc-a4e"></a>语言模型和数据集</h2><p>本节主要介绍语言序列这种特殊的序列在建模时需要注意的问题，以及数据集的处理方式。</p>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节所使用的代码有些问题，由于教材英文版与中文版有差异（英文版有略微更新），d2l库是以英文版为基准设计的，导致本节代码的运行会出现一些问题，需要做一些修改：</p>
<ol>
<li>添加<code>read_time_machine</code>函数而且相比之前章节的定义有修改<pre><code class="hljs lang-python"><span class="hljs-keyword">def</span> <span class="hljs-title function_">read_time_machine</span>():  <span class="hljs-comment">#@save</span>
    d2l.DATA_HUB[<span class="hljs-string">&#x27;time_machine&#x27;</span>] = (d2l.DATA_URL + <span class="hljs-string">&#x27;timemachine.txt&#x27;</span>, <span class="hljs-string">&#x27;090b5e7e70c295757f55df93cb0a180b9691891a&#x27;</span>)<span class="hljs-number">11111111111111</span>
    <span class="hljs-string">&quot;&quot;&quot;将时间机器数据集加载到文本行的列表中&quot;&quot;&quot;</span>
    <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(download(<span class="hljs-string">&#x27;time_machine&#x27;</span>), <span class="hljs-string">&#x27;r&#x27;</span>) <span class="hljs-keyword">as</span> f:
        lines = f.readlines()
    <span class="hljs-keyword">return</span> [re.sub(<span class="hljs-string">&#x27;[^A-Za-z]+&#x27;</span>, <span class="hljs-string">&#x27; &#x27;</span>, line).strip().lower() <span class="hljs-keyword">for</span> line <span class="hljs-keyword">in</span> lines]
</code></pre></li>
<li>修改<code>Vocab</code>的<code>__init__</code>中对<code>self.idx_to_token</code>的赋值为<pre><code class="hljs lang-python">        <span class="hljs-variable language_">self</span>.idx_to_token = <span class="hljs-built_in">list</span>(<span class="hljs-built_in">sorted</span>(<span class="hljs-built_in">set</span>(([<span class="hljs-string">&#x27;&lt;unk&gt;&#x27;</span>] <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> tokens <span class="hljs-keyword">or</span> (tokens <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-built_in">isinstance</span>(tokens[<span class="hljs-number">0</span>], <span class="hljs-built_in">tuple</span>)) <span class="hljs-keyword">else</span> [(<span class="hljs-string">&#x27;&lt;unk&gt;&#x27;</span>,)]) + reserved_tokens + [
            token <span class="hljs-keyword">for</span> token, freq <span class="hljs-keyword">in</span> <span class="hljs-variable language_">self</span>.token_freqs <span class="hljs-keyword">if</span> freq &gt;= min_freq])))
</code></pre></li>
</ol>
</div>
<p>语言模型预测的关键目标依然是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.645ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2053.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid x_1, \ldots, x_{t-1})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="12.806ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 5660.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid x_1, \ldots, x_{t-1})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1564.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2009,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3012.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{t-1}" transform="translate(3457.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5271.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，即给定前面几个单词后出现某个单词的条件概率。</p>
<p>那这个模型应该怎么设计呢？<strong>一个朴素的建模方式是</strong>：根据单词或单词元组在语料库中出现的频率计算联合概率，再根据公式计算出条件概率，例如<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="10.514ex" height="2.98ex" role="img" focusable="false" viewBox="0 -1067 4647 1317"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{P}(\text{learning} \mid \text{deep}) = \frac{n(\text{deep, learning})}{n(\text{deep})}"><g data-mml-node="TeXAtom" data-latex="\hat{P}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" transform="translate(477,273) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mtext" data-latex="\text{learning}" transform="translate(1143,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(278,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(722,0)"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(1222,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(1614,0)"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(2170,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(2448,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(3004,0)"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.662ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2944.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{P}(\text{learning} \mid \text{deep}) = \frac{n(\text{deep, learning})}{n(\text{deep})}"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mtext" data-latex="\text{deep}" transform="translate(555.8,0)"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(556,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1000,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(1444,0)"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2555.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.231ex;" xmlns="http://www.w3.org/2000/svg" width="15.37ex" height="3.594ex" role="img" focusable="false" viewBox="0 -1044.3 6793.4 1588.6"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{P}(\text{learning} \mid \text{deep}) = \frac{n(\text{deep, learning})}{n(\text{deep})}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{n(\text{deep, learning})}{n(\text{deep})}" transform="translate(1055.8,0)"><g data-mml-node="mrow" transform="translate(220,515.4) scale(0.707)" data-latex="n(\text{deep, learning})"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(600,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mtext" data-latex="\text{deep, learning}" transform="translate(989,0)"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(556,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1000,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(1444,0)"/><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z" transform="translate(2000,0)"/><path data-c="20" d="" transform="translate(2278,0)"/><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(2610,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(2888,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(3332,0)"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(3832,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(4224,0)"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(4780,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(5058,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(5614,0)"/></g><g data-mml-node="mo" data-latex=")" transform="translate(7103,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(1674.5,-368.9) scale(0.707)" data-latex="n(\text{deep})"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(600,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mtext" data-latex="\text{deep}" transform="translate(989,0)"><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(556,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1000,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(1444,0)"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2989,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="5497.6" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>。<strong>这样的一种简单的建模方式有几个问题</strong>：</p>
<ul>
<li><strong>工程上无法实现计数存储</strong>：单词元组的所有组合数量非常庞大，参数组合数量以词汇量为底的指数增加，我们无法存储所有的计数<ul>
<li>可以通过马尔可夫模型来近似，只需统计n元语法，无需统计所有长度的组合；或者使用隐变量的方式</li>
</ul>
</li>
<li><strong>无法理解语义</strong>：基于频数统计的模型无法捕捉同义词之间的语义关联，且泛化能力有限</li>
<li><strong>数据稀疏与长尾效应的问题</strong>：一些不常见的单词组合可能是存在的，但是在数据集中却找不到，导致无法统计这些单词元组的概率，模型无法正常工作<ul>
<li>这个问题存在一些打补丁的方案，例如添加拉普拉斯平滑，具体方法是在所有计数中添加一个小常量</li>
<li>但齐夫定律指出，事物出现的频率与其排名之间呈反比，通过计算语料库的数据可以发现，一元语法、二元语法和三元语法均符合齐夫定律</li>
<li>很多n元组很少出现，因此拉普拉斯平滑非常不适合语言建模</li>
</ul>
</li>
</ul>
<p>这种只是简单地统计先前“看到”的单词序列频率的模型肯定是表现不佳的。</p>
<p>接下来介绍<strong>如何根据数据集生成可供模型训练的小批量数据</strong>。由于模型中的网络一次处理具有预定义长度（例如n个时间步）的小批量序列，为了生成一个小批量数据的特征和标签，我们有两种典型的拆分方式：</p>
<ul>
<li><strong>随机采样</strong>：每个样本都是在原始的长序列上任意捕获的子序列（将原本长序列拆成长度为num_steps的子序列，按批次大小batch_size随机组合成多个批次）</li>
<li><strong>顺序分区</strong>：保证两个相邻的小批量中的子序列在原始序列上也是相邻的（将原本长序列拆成若干个子序列，每个子序列再拆成若干个子子序列，也就是样本，每个小批次的所有样本由每个子序列按顺序各取一个样本构成，这样可以确保相邻小批量之间的相同下标的样本在原始长序列中也是相邻的）</li>
</ul>
<h2><a id="toc-ad8" class="anchor" href="#toc-ad8"></a>循环神经网络实现</h2><div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节的d2l库缺失<code>load_corpus_time_machine</code>、<code>seq_data_iter_random</code>、<code>seq_data_iter_sequential</code>、<code>class SeqDataLoader</code>、<code>load_data_time_machine</code>等函数，简洁实现还需要<code>predict_ch8</code>、<code>grad_clipping</code>、<code>train_epoch_ch8</code>、<code>train_ch8</code>，可以手动补上或者直接回退旧版。</p>
</div>
<p>本节正式介绍循环神经网络，它是具有隐状态的神经网络。它与无隐状态的神经网络的关键区别在于：该网络存在时间步的概念，训练和推理过程需要增加一个对时间步的循环，并且在这个过程中保存一个跟随时间步增加而不断更新的隐状态。</p>
<p><strong>先不考虑时间步</strong>。假设我们在时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></svg></mjx-container></span>有小批量输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.731ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1207.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X}_t \in \mathbb{R}^{n \times d}"><g data-mml-node="msub" data-latex="\mathbf{X}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.995ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3091.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X}_t \in \mathbb{R}^{n \times d}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{n\times d}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n\times d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(600,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1378,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></g></svg></mjx-container></span>，它的大小取决于batch_size和vocab_size。我们需要计算的是：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.078ex;" xmlns="http://www.w3.org/2000/svg" width="34.026ex" height="5.288ex" role="img" focusable="false" viewBox="0 -1418.6 15039.6 2337.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\mathbf{H}_t &amp;= \phi(\mathbf{X}_t \mathbf{W}_{xh} + \mathbf{H}_{t-1} \mathbf{W}_{hh}  + \mathbf{b}_h) \\
\mathbf{O}_t &amp;= \mathbf{H}_t \mathbf{W}_{hq} + \mathbf{b}_q
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\mathbf{H}_t &amp;= \phi(\mathbf{X}_t \mathbf{W}_{xh} + \mathbf{H}_{t-1} \mathbf{W}_{hh}  + \mathbf{b}_h) \\
\mathbf{O}_t &amp;= \mathbf{H}_t \mathbf{W}_{hq} + \mathbf{b}_q
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,668.6)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\mathbf{H}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\phi" transform="translate(1333.6,0)"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1929.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2318.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x h}" transform="translate(3525.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(572,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5831.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6832,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h h}" transform="translate(8974,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(576,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11282.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_h" transform="translate(12283,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13412.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-631.4)"><g data-mml-node="mtd" transform="translate(36,0)"><g data-mml-node="msub" data-latex="\mathbf{O}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g><g data-mml-node="mi" transform="translate(897,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_t" transform="translate(1333.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h q}" transform="translate(2571.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h q}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(576,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(4792.9,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_q" transform="translate(5793.2,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.731ex" height="1.909ex" role="img" focusable="false" viewBox="0 -686 1207.3 843.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X}_t"><g data-mml-node="msub" data-latex="\mathbf{X}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>的每一行是样本在时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></svg></mjx-container></span>的单词在词典的index转化为的独热向量。所以我们对输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.72ex" height="1.934ex" role="img" focusable="false" viewBox="0 -697 1202.3 854.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{O}_t"><g data-mml-node="msub" data-latex="\mathbf{O}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g><g data-mml-node="mi" transform="translate(897,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>取softmax之后就是每个样本在时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></svg></mjx-container></span>模型预测的词典中每一个单词是下一个单词的概率。</p>
<p><strong>再考虑加上时间步的情况</strong>。数据集中的输入的形状其实是<code>(batch_size, num_steps)</code>（<code>(批次大小, 时间步数)</code>），值为词元在词典中的index。我们需要做两个操作才能执行上述的计算：</p>
<ul>
<li>将输入转置：我们是逐时间步训练的，每次训练一个小批量数据，因此需要时间步在前，小批量数据在后</li>
<li>将token转为独热向量</li>
</ul>
<p>最终我们得到的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="1.552ex" role="img" focusable="false" viewBox="0 -686 869 686"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg></mjx-container></span>就是形状为<code>(num_steps, batch_size, vocab_size)</code>的三维张量。</p>
<p><strong>再看损失计算和优化过程</strong>。由于同属分类问题，我们可以继续使用交叉熵损失，直接用每个时间步和小批次中每个样本的损失均值即可。</p>
<p>但是RNN有个特殊情况，每个小批次训练，都要做<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.593ex" height="1.532ex" role="img" focusable="false" viewBox="0 -677 704 677"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="T"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></svg></mjx-container></span>个时间步的上述计算，将会在反向传播过程中产生长度为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="4.934ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 2181 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(T)"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(1088,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1792,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>的矩阵乘法链，这会导致梯度爆炸或梯度消失。<strong>梯度裁剪</strong>是解决梯度爆炸的一个有效手段，它通过<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.301ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 575 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{g} \leftarrow \min\left(1, \frac{\theta}{\|\mathbf{g}\|}\right) \mathbf{g}"><g data-mml-node="TeXAtom" data-latex="\mathbf{g}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="g"><path data-c="1D420" d="M558 397C558 420 541 455 495 455C480 455 433 452 389 417C371 429 329 450 255 450C111 450 56 372 56 302C56 261 76 220 108 197C80 162 74 129 74 108C74 93 78 44 118 12C105 9 32-12 32-75C32-126 87-201 287-201C464-201 542-142 542-72C542-42 534 21 467 55C411 83 351 83 255 83C229 83 183 83 178 84C134 91 123 129 123 147C123 157 127 172 133 180C179 156 230 154 255 154C399 154 454 232 454 302C454 349 429 382 414 398C444 414 465 416 476 417C474 412 472 403 472 397C472 372 489 354 515 354C541 354 558 373 558 397M343 302C343 257 343 190 255 190C167 190 167 257 167 302C167 347 167 414 255 414C343 414 343 347 343 302M456-75C456-111 417-165 287-165C167-165 118-119 118-73C118-13 181-13 195-13L312-13C343-13 456-13 456-75Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.238ex;" xmlns="http://www.w3.org/2000/svg" width="16.41ex" height="3.437ex" role="img" focusable="false" viewBox="0 -972 7253.2 1519.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{g} \leftarrow \min\left(1, \frac{\theta}{\|\mathbf{g}\|}\right) \mathbf{g}"><g data-mml-node="mo" data-latex="\leftarrow"><path data-c="2190" d="M918 274L172 274C245 326 289 395 306 482L306 483L307 485C307 502 299 510 283 510C270 510 262 504 259 491C250 444 231 403 203 368C161 316 116 282 68 266C61 263 57 257 57 250C57 243 61 237 68 234C116 218 161 184 203 132C231 97 250 56 259 9C262-4 270-10 283-10C299-10 307-2 307 15L306 17L306 18C289 105 245 174 172 226L918 226C934 226 942 234 942 250C942 263 931 274 918 274Z"/></g><g data-mml-node="mo" data-latex="\min" transform="translate(1277.8,0)"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(833,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(1111,0)"/></g><g data-mml-node="mrow" data-latex="\left(1, \frac{\theta}{\|\mathbf{g}\|}\right)" transform="translate(3111.4,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M444-472C455-472 461-466 461-455C461-449 459-445 454-442C382-387 325-294 282-164C245-53 226 57 226 164L226 336C226 443 245 552 282 664C325 793 382 886 454 942C459 945 461 949 461 955C461 966 455 972 444 972C440 972 437 971 434 968C353 905 285 809 232 681C181 560 156 445 156 336L156 164C156 55 181-60 232-181C285-310 353-405 434-468C437-471 440-472 444-472Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(523,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1023,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\theta}{\|\mathbf{g}\|}" transform="translate(1467.7,0)"><g data-mml-node="mi" transform="translate(538.9,394) scale(0.707)" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g><g data-mml-node="mrow" transform="translate(220,-370.3) scale(0.707)" data-latex="\|\mathbf{g}\|"><g data-mml-node="mo" data-latex="\|"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{g}" data-mjx-texclass="ORD" transform="translate(398,0)"><g data-mml-node="mi" data-latex="g"><path data-c="1D420" d="M558 397C558 420 541 455 495 455C480 455 433 452 389 417C371 429 329 450 255 450C111 450 56 372 56 302C56 261 76 220 108 197C80 162 74 129 74 108C74 93 78 44 118 12C105 9 32-12 32-75C32-126 87-201 287-201C464-201 542-142 542-72C542-42 534 21 467 55C411 83 351 83 255 83C229 83 183 83 178 84C134 91 123 129 123 147C123 157 127 172 133 180C179 156 230 154 255 154C399 154 454 232 454 302C454 349 429 382 414 398C444 414 465 416 476 417C474 412 472 403 472 397C472 372 489 354 515 354C541 354 558 373 558 397M343 302C343 257 343 190 255 190C167 190 167 257 167 302C167 347 167 414 255 414C343 414 343 347 343 302M456-75C456-111 417-165 287-165C167-165 118-119 118-73C118-13 181-13 195-13L312-13C343-13 456-13 456-75Z"/></g></g><g data-mml-node="mo" data-latex="\|" transform="translate(973,0)"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g></g><rect width="1169.4" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(2877.1,0)"><path data-c="29" d="M89-468C170-405 238-310 291-181C342-60 367 55 367 164L367 336C367 445 342 560 291 681C238 810 170 905 89 968C85 971 82 972 79 972C68 972 62 966 62 955C62 950 64 945 68 942C140 887 198 795 241 664C278 552 297 443 297 336L297 164C297 57 278-52 241-164C198-295 140-387 68-442C64-445 62-450 62-455C62-466 68-472 79-472C82-472 86-471 89-468Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{g}" data-mjx-texclass="ORD" transform="translate(6678.2,0)"><g data-mml-node="mi" data-latex="g"><path data-c="1D420" d="M558 397C558 420 541 455 495 455C480 455 433 452 389 417C371 429 329 450 255 450C111 450 56 372 56 302C56 261 76 220 108 197C80 162 74 129 74 108C74 93 78 44 118 12C105 9 32-12 32-75C32-126 87-201 287-201C464-201 542-142 542-72C542-42 534 21 467 55C411 83 351 83 255 83C229 83 183 83 178 84C134 91 123 129 123 147C123 157 127 172 133 180C179 156 230 154 255 154C399 154 454 232 454 302C454 349 429 382 414 398C444 414 465 416 476 417C474 412 472 403 472 397C472 372 489 354 515 354C541 354 558 373 558 397M343 302C343 257 343 190 255 190C167 190 167 257 167 302C167 347 167 414 255 414C343 414 343 347 343 302M456-75C456-111 417-165 287-165C167-165 118-119 118-73C118-13 181-13 195-13L312-13C343-13 456-13 456-75Z"/></g></g></g></g></svg></mjx-container></span>，将梯度的大小限制在范数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.102ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1371 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\|\mathbf{g}\|"><g data-mml-node="mo" data-latex="\|"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{g}" data-mjx-texclass="ORD" transform="translate(398,0)"><g data-mml-node="mi" data-latex="g"><path data-c="1D420" d="M558 397C558 420 541 455 495 455C480 455 433 452 389 417C371 429 329 450 255 450C111 450 56 372 56 302C56 261 76 220 108 197C80 162 74 129 74 108C74 93 78 44 118 12C105 9 32-12 32-75C32-126 87-201 287-201C464-201 542-142 542-72C542-42 534 21 467 55C411 83 351 83 255 83C229 83 183 83 178 84C134 91 123 129 123 147C123 157 127 172 133 180C179 156 230 154 255 154C399 154 454 232 454 302C454 349 429 382 414 398C444 414 465 416 476 417C474 412 472 403 472 397C472 372 489 354 515 354C541 354 558 373 558 397M343 302C343 257 343 190 255 190C167 190 167 257 167 302C167 347 167 414 255 414C343 414 343 347 343 302M456-75C456-111 417-165 287-165C167-165 118-119 118-73C118-13 181-13 195-13L312-13C343-13 456-13 456-75Z"/></g></g><g data-mml-node="mo" data-latex="\|" transform="translate(973,0)"><path data-c="2016" d="M264-250C279-250 287-242 287-226L287 726C287 742 279 750 264 750C249 750 241 742 241 726L241-226C241-242 249-250 264-250M134-250C149-250 157-242 157-226L157 726C157 742 149 750 134 750C119 750 111 742 111 726L111-226C111-242 119-250 134-250Z"/></g></g></g></svg></mjx-container></span>不超过<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.061ex" height="1.62ex" role="img" focusable="false" viewBox="0 -705 469 716"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\theta"><g data-mml-node="mi" data-latex="\theta"><path data-c="1D703" d="M164-11C209-11 256 16 302 70C382 163 455 335 455 498C455 539 448 582 434 625C416 678 382 705 333 705C288 705 243 678 196 624C116 532 42 360 42 196C42 94 75-11 164-11M332 675C365 675 382 637 382 560C382 517 372 452 352 367L155 367C180 460 204 529 229 574C266 641 301 675 332 675M145 327L341 327C322 246 299 181 274 132C235 57 199 19 164 19C131 19 115 58 115 135C115 185 125 249 145 327Z"/></g></g></g></svg></mjx-container></span>的范围内，无需在梯度不大的时候也无差别地降低学习率。这一方法建立在损失函数具备利普希茨连续这一性质的假设之上，即损失函数不会突变，参数一步更新带来的损失变化有界。</p>
<p>除了损失，语言模型往往还会使用“<strong>困惑度</strong>”的概念来度量模型质量。困惑度（Perplexity, PPL）的计算公式为：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.817ex;" xmlns="http://www.w3.org/2000/svg" width="37.276ex" height="6.765ex" role="img" focusable="false" viewBox="0 -1745 16476 2990"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\exp\left(-\frac{1}{n} \sum_{t=1}^n \log P(x_t \mid x_{t-1}, \ldots, x_1)\right)"><g data-mml-node="mi" data-latex="\exp"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(1528,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left(-\frac{1}{n} \sum_{t=1}^n \log P(x_t \mid x_{t-1}, \ldots, x_1 )\right)" transform="translate(1694.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M798-1245C815-1245 823-1237 823-1220C823-1212 820-1205 813-1200C732-1139 659-1043 592-910C473-673 385-340 385 1L385 499C385 654 403 810 438 967C500 1247 630 1562 813 1700C820 1705 823 1712 823 1720C823 1737 815 1745 798 1745C793 1745 788 1743 784 1740C697 1673 614 1574 536 1441C398 1205 277 850 277 499L277 1C277-329 388-667 512-899C594-1050 685-1164 784-1240C788-1243 793-1245 798-1245Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(875,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{n}" transform="translate(1653,0)"><g data-mml-node="mn" data-latex="1" transform="translate(270,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" data-latex="n" transform="translate(220,-686)"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><rect width="800" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{t=1}^n" transform="translate(2859.7,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(142.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(509.9,1150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(4470.3,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(5748.3,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="P" transform="translate(5915,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(6669,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(7058,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(8246,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_{t-1}" transform="translate(8801.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(10615.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(11060.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(12064.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(12508.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13517.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(13906.3,0)"><path data-c="29" d="M598 1L598 499C598 829 487 1167 363 1399C281 1550 190 1664 91 1740C87 1743 82 1745 77 1745C60 1745 52 1737 52 1720C52 1712 55 1705 62 1700C143 1639 216 1543 283 1410C402 1173 490 840 490 499L490 1C490-154 472-310 437-467C375-747 245-1062 62-1200C55-1205 52-1212 52-1220C52-1237 60-1245 77-1245C82-1245 87-1243 91-1240C178-1173 261-1074 339-941C477-705 598-350 598 1Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>它计算的是每个词预测概率倒数的几何平均数，含义为：<strong>平均而言，模型需要在大约多少个候选词元中挑选出正确的下一词</strong>。困惑度通常仅作为评估模型效果的指标，训练时实际使用的损失函数仍是交叉熵。</p>
<p>最后还要注意一下<strong>隐变量的初始化问题</strong>。每一个epoch我们肯定要对隐变量做初始化，初始化为0即可。而一个epoch中的每个小批量样本在训练前是否要初始化为0，取决于数据集生成方式。如果是随机抽样，就需要初始化为0；如果是顺序分区就不需要，这是因为每个小批量样本之间在原始序列上是相邻的，隐变量状态可以保留，但是这种情况我们需要分离梯度（因为产生了跨批次复用，但只需要计算本批次的梯度，防止梯度计算链路过长）。隐变量在时间步之间是要保留和不断更新的。</p>
<p>对于预测过程来说，本质上就是一个样本跑一遍模型，但是由于输入文本是多个时间步的数据，因此需要通过预热期进行自我更新，以获得比初始值更好的隐状态。</p>
<h2><a id="toc-5f6" class="anchor" href="#toc-5f6"></a>通过时间反向传播</h2><p>本节将更深入地探讨序列模型反向传播的细节。</p>
<p>对于反向传播，使用链式法则，目标函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>关于参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.729ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 1206.3 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w_h"><g data-mml-node="msub" data-latex="w_h"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></svg></mjx-container></span>的梯度为：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -6.39ex;" xmlns="http://www.w3.org/2000/svg" width="39.863ex" height="13.911ex" role="img" focusable="false" viewBox="0 -3324.4 17619.6 6148.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\frac{\partial L}{\partial w_h}  &amp; = \frac{1}{T}\sum_{t=1}^T \frac{\partial l(y_t, o_t)}{\partial w_h}  \\&amp; = \frac{1}{T}\sum_{t=1}^T \frac{\partial l(y_t, o_t)}{\partial o_t} \frac{\partial g(h_t, w_o)}{\partial h_t}  \frac{\partial h_t}{\partial w_h}
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\frac{\partial L}{\partial w_h}  &amp; = \frac{1}{T}\sum_{t=1}^T \frac{\partial l(y_t, o_t)}{\partial w_h}  \\&amp; = \frac{1}{T}\sum_{t=1}^T \frac{\partial l(y_t, o_t)}{\partial o_t} \frac{\partial g(h_t, w_o)}{\partial h_t}  \frac{\partial h_t}{\partial w_h}
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1595.7)"><g data-mml-node="mtd"><g data-mml-node="mfrac" data-latex="\frac{\partial L}{\partial w_h}"><g data-mml-node="mrow" data-latex="\partial L" transform="translate(482.6,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="L" transform="translate(566,0)"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="1972.3" height="60" x="120" y="220"/></g></g><g data-mml-node="mtd" transform="translate(2212.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{T}" transform="translate(1333.6,0)"><g data-mml-node="mn" data-latex="1" transform="translate(322,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(220,-686)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><rect width="904" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{t=1}^T" transform="translate(2644.2,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(142.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(473.1,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mfrac" data-latex="\frac{\partial l(y_t, o_t)}{\partial w_h}" transform="translate(4254.9,0)"><g data-mml-node="mrow" data-latex="\partial l(y_t, o_t)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(566,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(864,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_t" transform="translate(1253,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2081.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="o_t" transform="translate(2525.9,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3349.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(1203,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="3938.2" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1628.7)"><g data-mml-node="mtd" transform="translate(2212.3,0)"/><g data-mml-node="mtd" transform="translate(2212.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{T}" transform="translate(1333.6,0)"><g data-mml-node="mn" data-latex="1" transform="translate(322,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(220,-686)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><rect width="904" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{t=1}^T" transform="translate(2644.2,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(142.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(473.1,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mfrac" data-latex="\frac{\partial l(y_t, o_t)}{\partial o_t}" transform="translate(4254.9,0)"><g data-mml-node="mrow" data-latex="\partial l(y_t, o_t)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(566,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(864,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_t" transform="translate(1253,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2081.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="o_t" transform="translate(2525.9,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3349.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial o_t" transform="translate(1394.5,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="o_t" transform="translate(566,0)"><g data-mml-node="mi" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g><g data-mml-node="mi" transform="translate(518,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><rect width="3938.2" height="60" x="120" y="220"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial g(h_t, w_o)}{\partial h_t}" transform="translate(8433.1,0)"><g data-mml-node="mrow" data-latex="\partial g(h_t, w_o)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="g" transform="translate(566,0)"><path data-c="1D454" d="M15-141C15-184 60-205 150-205C197-205 241-193 280-170C324-144 351-109 362-66L471 373C473 383 474 389 474 392C474 412 463 422 442 422C420 422 406 410 399 387C377 424 347 442 310 442C246 442 189 410 140 346C95 286 72 223 72 158C72 71 123-3 207-3C246-3 282 14 315 47L285-71C256-140 211-175 148-175C122-175 100-173 82-169C103-158 113-141 113-118C113-93 99-80 72-80C40-80 15-109 15-141M356 392C376 371 386 351 386 331C386 330 385 325 383 318L336 129C330 106 313 82 286 60C259 38 233 27 210 27C170 27 150 56 150 114C150 169 184 291 204 327C235 384 270 412 311 412C329 412 344 405 356 392Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1043,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(1432,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2346.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_o" transform="translate(2790.9,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3932.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial h_t" transform="translate(1640.8,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><rect width="4521.9" height="60" x="120" y="220"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial h_t}{\partial w_h}" transform="translate(13195,0)"><g data-mml-node="mrow" data-latex="\partial h_t" transform="translate(366,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="1972.3" height="60" x="120" y="220"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>其中，前两项比较简单，而第三项是需要循环地计算的：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -5.915ex;" xmlns="http://www.w3.org/2000/svg" width="72.354ex" height="12.961ex" role="img" focusable="false" viewBox="0 -3114.3 31980.4 5728.6"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\frac{\partial h_t}{\partial w_h}&amp;= \frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h} +\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial h_{t-1}} \frac{\partial h_{t-1}}{\partial w_h} \\
&amp;=\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h}+\sum_{i=1}^{t-1}\left(\prod_{j=i+1}^{t} \frac{\partial f(x_{j},h_{j-1},w_h)}{\partial h_{j-1}} \right) \frac{\partial f(x_{i},h_{i-1},w_h)}{\partial w_h}
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\frac{\partial h_t}{\partial w_h}&amp;= \frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h} +\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial h_{t-1}} \frac{\partial h_{t-1}}{\partial w_h} \\
&amp;=\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h}+\sum_{i=1}^{t-1}\left(\prod_{j=i+1}^{t} \frac{\partial f(x_{j},h_{j-1},w_h)}{\partial h_{j-1}} \right) \frac{\partial f(x_{i},h_{i-1},w_h)}{\partial w_h}
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1658.3)"><g data-mml-node="mtd"><g data-mml-node="mfrac" data-latex="\frac{\partial h_t}{\partial w_h}"><g data-mml-node="mrow" data-latex="\partial h_t" transform="translate(366,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="1972.3" height="60" x="120" y="220"/></g></g><g data-mml-node="mtd" transform="translate(2212.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h}" transform="translate(1333.6,0)"><g data-mml-node="mrow" data-latex="\partial f(x_{t},h_{t-1},w_h)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{t}" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2417.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(2861.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(4679.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(5124.5,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6330.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(2693.8,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="6919.8" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="+" transform="translate(8715.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial h_{t-1}}" transform="translate(9715.8,0)"><g data-mml-node="mrow" data-latex="\partial f(x_{t},h_{t-1},w_h)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{t}" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2417.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(2861.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(4679.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(5124.5,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6330.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial h_{t-1}" transform="translate(2387.9,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><rect width="6919.8" height="60" x="120" y="220"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial h_{t-1}}{\partial w_h}" transform="translate(16875.7,0)"><g data-mml-node="mrow" data-latex="\partial h_{t-1}" transform="translate(220,676)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(525.8,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="2583.9" height="60" x="120" y="220"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1281.4)"><g data-mml-node="mtd" transform="translate(2212.3,0)"/><g data-mml-node="mtd" transform="translate(2212.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(x_{t},h_{t-1},w_h)}{\partial w_h}" transform="translate(1333.6,0)"><g data-mml-node="mrow" data-latex="\partial f(x_{t},h_{t-1},w_h)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{t}" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{t}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2417.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(2861.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(4679.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(5124.5,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6330.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(2693.8,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="6919.8" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="+" transform="translate(8715.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^{t-1}" transform="translate(9715.8,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(148.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(142.5,1150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mrow" data-latex="\left(\prod_{j=i+1}^{t} \frac{\partial f(x_{j},h_{j-1},w_h)}{\partial h_{j-1}} \right)" transform="translate(11326.5,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M798-1245C815-1245 823-1237 823-1220C823-1212 820-1205 813-1200C732-1139 659-1043 592-910C473-673 385-340 385 1L385 499C385 654 403 810 438 967C500 1247 630 1562 813 1700C820 1705 823 1712 823 1720C823 1737 815 1745 798 1745C793 1745 788 1743 784 1740C697 1673 614 1574 536 1441C398 1205 277 850 277 499L277 1C277-329 388-667 512-899C594-1050 685-1164 784-1240C788-1243 793-1245 798-1245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{j=i+1}^{t}" transform="translate(875,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(355.5,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{j=i+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(1190,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1535,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2313,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(866.9,1150) scale(0.707)" data-latex="{t}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(x_{j},h_{j-1},w_h)}{\partial h_{j-1}}" transform="translate(3030.8,0)"><g data-mml-node="mrow" data-latex="\partial f(x_{j},h_{j-1},w_h)" transform="translate(220,755)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{j}" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2453.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{j-1}" transform="translate(2898,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(4752,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(5196.7,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6403,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial h_{j-1}" transform="translate(2406,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="h_{j-1}" transform="translate(566,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><rect width="6992" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(10262.7,0)"><path data-c="29" d="M598 1L598 499C598 829 487 1167 363 1399C281 1550 190 1664 91 1740C87 1743 82 1745 77 1745C60 1745 52 1737 52 1720C52 1712 55 1705 62 1700C143 1639 216 1543 283 1410C402 1173 490 840 490 499L490 1C490-154 472-310 437-467C375-747 245-1062 62-1200C55-1205 52-1212 52-1220C52-1237 60-1245 77-1245C82-1245 87-1243 91-1240C178-1173 261-1074 339-941C477-705 598-350 598 1Z"/></g></g><g data-mml-node="mfrac" data-latex="\frac{\partial f(x_{i},h_{i-1},w_h)}{\partial w_h}" transform="translate(22630.9,0)"><g data-mml-node="mrow" data-latex="\partial f(x_{i},h_{i-1},w_h)" transform="translate(220,708)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(566,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1118,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{i}" transform="translate(1507,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{i}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2406,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{i-1}" transform="translate(2850.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{i-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(345,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(4657.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(5101.9,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6308.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\partial w_h" transform="translate(2682.5,-686)"><g data-mml-node="mi" data-latex="\partial"><path data-c="1D715" d="M256 574C256 597 241 610 212 612C243 659 288 683 347 683C439 683 484 606 484 508C484 467 476 417 461 356C444 425 401 460 334 460C257 460 190 428 130 366C70 304 40 235 40 158C40 121 53 83 79 45C110 0 158-22 225-22C315-22 390 20 449 105C505 187 566 329 566 456C566 527 548 587 512 635C473 689 418 716 349 716C282 716 232 693 198 646C171 609 157 579 157 556C157 530 171 517 199 517C229 517 256 544 256 574M439 303C439 240 420 178 381 117C338 48 287 14 228 14C162 14 124 57 124 121C124 149 131 188 145 238C159 288 173 323 188 344C228 401 277 430 334 430C407 430 439 376 439 303Z"/></g><g data-mml-node="msub" data-latex="w_h" transform="translate(566,0)"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="mi" transform="translate(749,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><rect width="6897.2" height="60" x="120" y="220"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>当<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></svg></mjx-container></span>很大时这个链就会变得很长，计算量会爆炸。常见的有这么几种计算方案：</p>
<ul>
<li><strong>完全计算</strong>：计算非常缓慢，并且可能会发生梯度爆炸，初始条件的微小变化就可能会对结果产生巨大的影响。</li>
<li><strong>截断时间步</strong>：只在固定时间步内计算梯度，例如前面已经在用的分离梯度的操作。</li>
<li><strong>随机截断</strong>：每个样本以一个概率随机一个时间步截断，并根据概率加大长序列梯度值的权重，实现最终计算出的梯度值的期望不变（这里有点类似于dropout的做法）。这种操作理论上看着很好，但实际应用中却不是很理想。</li>
</ul>
<h1><a id="toc-db5" class="anchor" href="#toc-db5"></a>现代循环神经网络</h1><p>本章介绍RNN的优化和变体：解决数值不稳定性的GRU和LSTM、具有多隐藏层的深层RNN、基于前向和后向循环计算的双向RNN、其他序列学习问题的建模方法等。</p>
<h2><a id="toc-cef" class="anchor" href="#toc-cef"></a>门控循环单元（GRU）</h2><div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节的d2l库缺失<code>class RNNModelScratch</code>、<code>class RNNModel</code>。</p>
</div>
<p>RNN的矩阵连续乘积容易导致梯度消失或梯度爆炸，然而这种时序信息又是我们所需要的。</p>
<p>门控循环神经网络通过引入重置门和更新门，优化了RNN的网络结构，精准控制信息的保留与遗忘，在一定程度上避免了梯度消失或梯度爆炸，使其可以更好地捕获时间步距离很长的序列上的依赖关系。</p>
<ul>
<li><strong>重置门</strong>：控制<code>新的隐状态候选</code> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.802ex" height="2.592ex" role="img" focusable="false" viewBox="0 -988 1238.3 1145.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\tilde{\mathbf{H}}_t"><g data-mml-node="msub" data-latex="\tilde{\mathbf{H}}_t"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{H}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mo" transform="translate(450,235) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>依赖上一个隐状态的程度，极端情况就完全不依赖于之前的隐状态，只取决于当前的最新输入，实现<strong>重置</strong>隐状态的效果。这有助于捕获序列中的短期依赖关系。</li>
<li><strong>更新门</strong>：确定<code>新的隐状态</code> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.802ex" height="1.909ex" role="img" focusable="false" viewBox="0 -686 1238.3 843.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{H}_t"><g data-mml-node="msub" data-latex="\mathbf{H}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>在多大程度上来自旧的状态，即<code>旧的隐状态</code> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.472ex;" xmlns="http://www.w3.org/2000/svg" width="4.846ex" height="2.024ex" role="img" focusable="false" viewBox="0 -686 2141.9 894.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{H}_{t-1}"><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>和<code>新的隐状态候选</code> <span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.802ex" height="2.592ex" role="img" focusable="false" viewBox="0 -988 1238.3 1145.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\tilde{\mathbf{H}}_t"><g data-mml-node="msub" data-latex="\tilde{\mathbf{H}}_t"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{H}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mo" transform="translate(450,235) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>的比例关系，极端情况就完全使用旧的隐状态，实现<strong>跳过</strong>当前时间步的效果。这有助于捕获序列中的长期依赖关系。</li>
</ul>
<p>其计算隐状态的公式如下：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -5.516ex;" xmlns="http://www.w3.org/2000/svg" width="44.835ex" height="12.163ex" role="img" focusable="false" viewBox="0 -2938 19816.9 5376"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\mathbf{R}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xr} + \mathbf{H}_{t-1} \mathbf{W}_{hr} + \mathbf{b}_r) \\
\mathbf{Z}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xz} + \mathbf{H}_{t-1} \mathbf{W}_{hz} + \mathbf{b}_z) \\
\tilde{\mathbf{H}}_t &amp;= \tanh(\mathbf{X}_t \mathbf{W}_{xh} + \left(\mathbf{R}_t \odot \mathbf{H}_{t-1}\right) \mathbf{W}_{hh} + \mathbf{b}_h) \\
\mathbf{H}_t &amp;= \mathbf{Z}_t \odot \mathbf{H}_{t-1}  + (1 - \mathbf{Z}_t) \odot \tilde{\mathbf{H}}_t
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\mathbf{R}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xr} + \mathbf{H}_{t-1} \mathbf{W}_{hr} + \mathbf{b}_r) \\
\mathbf{Z}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xz} + \mathbf{H}_{t-1} \mathbf{W}_{hz} + \mathbf{b}_z) \\
\tilde{\mathbf{H}}_t &amp;= \tanh(\mathbf{X}_t \mathbf{W}_{xh} + \left(\mathbf{R}_t \odot \mathbf{H}_{t-1}\right) \mathbf{W}_{hh} + \mathbf{b}_h) \\
\mathbf{H}_t &amp;= \mathbf{Z}_t \odot \mathbf{H}_{t-1}  + (1 - \mathbf{Z}_t) \odot \tilde{\mathbf{H}}_t
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,2188)"><g data-mml-node="mtd" transform="translate(37,0)"><g data-mml-node="msub" data-latex="\mathbf{R}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="1D411" d="M858 95C858 117 844 117 834 117C813 117 812 107 811 94C806 47 777 25 747 25C687 25 678 96 673 138C671 149 663 218 662 223C648 293 593 324 550 340C666 370 717 435 717 501C717 602 607 686 419 686L39 686L39 639L147 639L147 47L39 47L39 0C75 3 173 3 215 3C257 3 355 3 391 0L391 47L283 47L283 325L400 325C414 325 458 325 489 291C521 256 521 237 521 164C521 98 521 49 591 15C635-7 697-11 738-11C845-11 858 79 858 95M564 500C564 444 564 361 399 361L283 361L283 639L401 639C562 639 564 561 564 500Z"/></g></g><g data-mml-node="mi" transform="translate(896,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sigma" transform="translate(1333.6,0)"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1904.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2293.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x r}" transform="translate(3500.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x r}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="r" transform="translate(572,0)"><path data-c="1D45F" d="M436 374C436 416 395 442 351 442C302 442 261 419 227 372C217 411 183 442 136 442C95 442 65 410 44 345C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C150 413 159 399 159 371C159 358 154 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 110-11C130-11 143-1 150 19L169 91C180 134 187 162 190 175L221 303C223 311 231 324 244 343C271 381 302 413 351 413C363 413 373 411 382 406C352 397 337 378 337 351C337 325 351 312 378 312C411 312 436 341 436 374Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5718.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6718.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h r}" transform="translate(8860.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h r}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="r" transform="translate(576,0)"><path data-c="1D45F" d="M436 374C436 416 395 442 351 442C302 442 261 419 227 372C217 411 183 442 136 442C95 442 65 410 44 345C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C150 413 159 399 159 371C159 358 154 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 110-11C130-11 143-1 150 19L169 91C180 134 187 162 190 175L221 303C223 311 231 324 244 343C271 381 302 413 351 413C363 413 373 411 382 406C352 397 337 378 337 351C337 325 351 312 378 312C411 312 436 341 436 374Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11081,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_r" transform="translate(12081.2,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="r"><path data-c="1D45F" d="M436 374C436 416 395 442 351 442C302 442 261 419 227 372C217 411 183 442 136 442C95 442 65 410 44 345C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C150 413 159 399 159 371C159 358 154 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 110-11C130-11 143-1 150 19L169 91C180 134 187 162 190 175L221 303C223 311 231 324 244 343C271 381 302 413 351 413C363 413 373 411 382 406C352 397 337 378 337 351C337 325 351 312 378 312C411 312 436 341 436 374Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13122.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,888)"><g data-mml-node="mtd" transform="translate(197,0)"><g data-mml-node="msub" data-latex="\mathbf{Z}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{Z}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="Z"><path data-c="1D419" d="M645 284L598 284C590 173 576 51 371 51L231 51L630 637C638 649 638 650 638 661C638 686 627 686 606 686L92 686L80 445L127 445C135 578 202 639 342 639L472 639L72 52C64 40 64 37 64 26C64 0 74 0 96 0L627 0Z"/></g></g><g data-mml-node="mi" transform="translate(736,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sigma" transform="translate(1333.6,0)"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1904.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2293.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x z}" transform="translate(3500.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x z}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="z" transform="translate(572,0)"><path data-c="1D467" d="M162 92L145 90C193 137 230 171 255 194L351 283C374 304 398 330 421 359C452 397 467 420 467 428C467 437 462 442 452 442C445 442 439 438 434 429C409 388 386 368 364 368C342 368 326 386 317 398C293 427 269 442 246 442C220 442 193 430 165 404C137 378 123 352 123 326C123 316 128 311 139 311C146 311 152 316 156 325C167 354 194 368 235 368C249 368 269 363 296 354C320 345 343 340 364 339C308 284 265 244 234 217L145 134C130 119 111 99 90 74C59 35 43 12 43 3C43-6 48-11 59-11C65-11 71-6 78 4C103 43 130 63 158 63C174 63 192 51 212 26C232 1 255-11 278-11C312-11 346 7 382 42C418 77 436 111 436 144C436 153 431 158 420 158C413 158 407 153 402 143C387 100 344 63 288 63C264 63 186 92 162 92Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5729.7,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6729.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h z}" transform="translate(8871.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h z}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="z" transform="translate(576,0)"><path data-c="1D467" d="M162 92L145 90C193 137 230 171 255 194L351 283C374 304 398 330 421 359C452 397 467 420 467 428C467 437 462 442 452 442C445 442 439 438 434 429C409 388 386 368 364 368C342 368 326 386 317 398C293 427 269 442 246 442C220 442 193 430 165 404C137 378 123 352 123 326C123 316 128 311 139 311C146 311 152 316 156 325C167 354 194 368 235 368C249 368 269 363 296 354C320 345 343 340 364 339C308 284 265 244 234 217L145 134C130 119 111 99 90 74C59 35 43 12 43 3C43-6 48-11 59-11C65-11 71-6 78 4C103 43 130 63 158 63C174 63 192 51 212 26C232 1 255-11 278-11C312-11 346 7 382 42C418 77 436 111 436 144C436 153 431 158 420 158C413 158 407 153 402 143C387 100 344 63 288 63C264 63 186 92 162 92Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11103.6,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_z" transform="translate(12103.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="z"><path data-c="1D467" d="M162 92L145 90C193 137 230 171 255 194L351 283C374 304 398 330 421 359C452 397 467 420 467 428C467 437 462 442 452 442C445 442 439 438 434 429C409 388 386 368 364 368C342 368 326 386 317 398C293 427 269 442 246 442C220 442 193 430 165 404C137 378 123 352 123 326C123 316 128 311 139 311C146 311 152 316 156 325C167 354 194 368 235 368C249 368 269 363 296 354C320 345 343 340 364 339C308 284 265 244 234 217L145 134C130 119 111 99 90 74C59 35 43 12 43 3C43-6 48-11 59-11C65-11 71-6 78 4C103 43 130 63 158 63C174 63 192 51 212 26C232 1 255-11 278-11C312-11 346 7 382 42C418 77 436 111 436 144C436 153 431 158 420 158C413 158 407 153 402 143C387 100 344 63 288 63C264 63 186 92 162 92Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13156.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-650)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\tilde{\mathbf{H}}_t"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{H}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mo" transform="translate(450,235) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\tanh" transform="translate(1333.6,0)"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(389,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(889,0)"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(1445,0)"/></g><g data-mml-node="mo" transform="translate(3334.6,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(3334.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(3723.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x h}" transform="translate(4930.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(572,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7236.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mrow" data-latex="\left(\mathbf{R}_t \odot \mathbf{H}_{t-1}\right)" transform="translate(8237,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{R}_t" transform="translate(389,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="1D411" d="M858 95C858 117 844 117 834 117C813 117 812 107 811 94C806 47 777 25 747 25C687 25 678 96 673 138C671 149 663 218 662 223C648 293 593 324 550 340C666 370 717 435 717 501C717 602 607 686 419 686L39 686L39 639L147 639L147 47L39 47L39 0C75 3 173 3 215 3C257 3 355 3 391 0L391 47L283 47L283 325L400 325C414 325 458 325 489 291C521 256 521 237 521 164C521 98 521 49 591 15C635-7 697-11 738-11C845-11 858 79 858 95M564 500C564 444 564 361 399 361L283 361L283 639L401 639C562 639 564 561 564 500Z"/></g></g><g data-mml-node="mi" transform="translate(896,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\odot" transform="translate(1812.5,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(2816.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(4958.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h h}" transform="translate(13751.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(576,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(16060.2,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_h" transform="translate(17060.4,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(18189.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-2188)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\mathbf{H}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\mathbf{Z}_t" transform="translate(1333.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{Z}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="Z"><path data-c="1D419" d="M645 284L598 284C590 173 576 51 371 51L231 51L630 637C638 649 638 650 638 661C638 686 627 686 606 686L92 686L80 445L127 445C135 578 202 639 342 639L472 639L72 52C64 40 64 37 64 26C64 0 74 0 96 0L627 0Z"/></g></g><g data-mml-node="mi" transform="translate(736,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\odot" transform="translate(2597,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(3601.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5965.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(6965.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(7354.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(8076.9,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="\mathbf{Z}_t" transform="translate(9077.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{Z}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="Z"><path data-c="1D419" d="M645 284L598 284C590 173 576 51 371 51L231 51L630 637C638 649 638 650 638 661C638 686 627 686 606 686L92 686L80 445L127 445C135 578 202 639 342 639L472 639L72 52C64 40 64 37 64 26C64 0 74 0 96 0L627 0Z"/></g></g><g data-mml-node="mi" transform="translate(736,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(10118.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\odot" transform="translate(10729.6,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="msub" data-latex="\tilde{\mathbf{H}}_t" transform="translate(11733.8,0)"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{H}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mo" transform="translate(450,235) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<h2><a id="toc-62c" class="anchor" href="#toc-62c"></a>长短期记忆网络（LSTM）</h2><p>LSTM比GRU略微复杂一点，使用了输入门、遗忘门和输出门等三个门，两个隐藏层输出隐状态和记忆元（但只有隐状态会传递到输出层，而记忆元完全属于内部信息）。具体公式如下：</p>
<p>输入门、遗忘门、输出门以及候选记忆元：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -5.31ex;" xmlns="http://www.w3.org/2000/svg" width="36.437ex" height="11.751ex" role="img" focusable="false" viewBox="0 -2847 16105.2 5194"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\mathbf{I}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xi} + \mathbf{H}_{t-1} \mathbf{W}_{hi} + \mathbf{b}_i) \\
\mathbf{F}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xf} + \mathbf{H}_{t-1} \mathbf{W}_{hf} + \mathbf{b}_f) \\
\mathbf{O}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xo} + \mathbf{H}_{t-1} \mathbf{W}_{ho} + \mathbf{b}_o) \\
\tilde{\mathbf{C}}_t &amp;= \text{tanh}(\mathbf{X}_t \mathbf{W}_{xc} + \mathbf{H}_{t-1} \mathbf{W}_{hc} + \mathbf{b}_c)
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\mathbf{I}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xi} + \mathbf{H}_{t-1} \mathbf{W}_{hi} + \mathbf{b}_i) \\
\mathbf{F}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xf} + \mathbf{H}_{t-1} \mathbf{W}_{hf} + \mathbf{b}_f) \\
\mathbf{O}_t &amp;= \sigma(\mathbf{X}_t \mathbf{W}_{xo} + \mathbf{H}_{t-1} \mathbf{W}_{ho} + \mathbf{b}_o) \\
\tilde{\mathbf{C}}_t &amp;= \text{tanh}(\mathbf{X}_t \mathbf{W}_{xc} + \mathbf{H}_{t-1} \mathbf{W}_{hc} + \mathbf{b}_c)
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,2097)"><g data-mml-node="mtd" transform="translate(428,0)"><g data-mml-node="msub" data-latex="\mathbf{I}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{I}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="I"><path data-c="1D408" d="M403 0L403 47L289 47L289 639L403 639L403 686C362 683 264 683 218 683C172 683 74 683 33 686L33 639L147 639L147 47L33 47L33 0C74 3 172 3 218 3C264 3 362 3 403 0Z"/></g></g><g data-mml-node="mi" transform="translate(469,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1202.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sigma" transform="translate(1333.6,0)"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1904.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2293.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x i}" transform="translate(3500.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x i}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(572,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5643.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6643.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h i}" transform="translate(8785.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h i}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(576,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(10931.1,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_i" transform="translate(11931.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12897.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,797)"><g data-mml-node="mtd" transform="translate(140,0)"><g data-mml-node="msub" data-latex="\mathbf{F}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{F}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="F"><path data-c="1D405" d="M675 439L644 680L39 680L39 633L147 633L147 47L39 47L39 0C77 3 178 3 222 3C271 3 380 3 424 0L424 47L289 47L289 317L339 317C435 317 444 274 444 200L491 200L491 481L444 481C444 407 436 364 339 364L289 364L289 633L429 633C590 633 613 556 628 439Z"/></g></g><g data-mml-node="mi" transform="translate(757,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1202.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sigma" transform="translate(1333.6,0)"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1904.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2293.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x f}" transform="translate(3500.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x f}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(572,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5789.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6790.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h f}" transform="translate(8932,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h f}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(576,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11223.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_f" transform="translate(12224.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13336.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-548)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\mathbf{O}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g><g data-mml-node="mi" transform="translate(897,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1202.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sigma" transform="translate(1333.6,0)"><path data-c="1D70E" d="M525 431L300 431C252 431 207 416 166 385C102 336 38 250 38 148C38 58 100-11 190-11C257-11 317 18 368 76C417 132 441 194 441 263C441 304 432 338 414 366L515 366C550 366 567 378 567 403C567 426 550 431 525 431M107 121C107 180 121 234 150 282C184 338 228 366 283 366C341 366 370 336 370 275C370 250 365 221 355 187C335 116 302 66 256 39C233 25 211 18 191 18C136 18 107 63 107 121Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1904.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(2293.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x o}" transform="translate(3500.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="o" transform="translate(572,0)"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5742.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(6742.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h o}" transform="translate(8884.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h o}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="o" transform="translate(576,0)"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(11129.1,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_o" transform="translate(12129.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13194.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-2097)"><g data-mml-node="mtd" transform="translate(33,0)"><g data-mml-node="msub" data-latex="\tilde{\mathbf{C}}_t"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{C}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="mo" transform="translate(466.5,246) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(864,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1202.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mtext" data-latex="\text{tanh}" transform="translate(1333.6,0)"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(389,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(889,0)"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(1445,0)"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3334.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(3723.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{x c}" transform="translate(4930.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{x c}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="c" transform="translate(572,0)"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7135.7,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{H}_{t-1}" transform="translate(8135.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h c}" transform="translate(10277.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h c}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="c" transform="translate(576,0)"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(12485.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_c" transform="translate(13485.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="c"><path data-c="1D450" d="M328 325C328 300 341 287 368 287C404 287 427 318 427 354C427 410 368 442 308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 61 106-11 204-11C257-11 304 2 345 27C379 48 404 69 420 90C427 99 430 106 430 109C430 120 425 126 414 126C409 126 404 122 398 114C365 70 324 42 277 30C246 22 223 18 206 18C149 18 121 53 121 122C121 184 150 274 174 317C198 361 249 413 308 413C346 413 372 402 386 381C355 378 328 358 328 325Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(14513.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>记忆元和隐状态：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.318ex;" xmlns="http://www.w3.org/2000/svg" width="25.624ex" height="5.767ex" role="img" focusable="false" viewBox="0 -1524.5 11325.9 2549"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\mathbf{C}_t &amp;= \mathbf{F}_t \odot \mathbf{C}_{t-1} + \mathbf{I}_t \odot \tilde{\mathbf{C}}_t \\
\mathbf{H}_t &amp;= \mathbf{O}_t \odot \tanh(\mathbf{C}_t)
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\mathbf{C}_t &amp;= \mathbf{F}_t \odot \mathbf{C}_{t-1} + \mathbf{I}_t \odot \tilde{\mathbf{C}}_t \\
\mathbf{H}_t &amp;= \mathbf{O}_t \odot \tanh(\mathbf{C}_t)
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,525.5)"><g data-mml-node="mtd" transform="translate(69,0)"><g data-mml-node="msub" data-latex="\mathbf{C}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="mi" transform="translate(864,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\mathbf{F}_t" transform="translate(1333.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{F}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="F"><path data-c="1D405" d="M675 439L644 680L39 680L39 633L147 633L147 47L39 47L39 0C77 3 178 3 222 3C271 3 380 3 424 0L424 47L289 47L289 317L339 317C435 317 444 274 444 200L491 200L491 481L444 481C444 407 436 364 339 364L289 364L289 633L429 633C590 633 613 556 628 439Z"/></g></g><g data-mml-node="mi" transform="translate(757,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\odot" transform="translate(2618,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="msub" data-latex="\mathbf{C}_{t-1}" transform="translate(3622.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(864,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5917.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{I}_t" transform="translate(6917.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{I}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="I"><path data-c="1D408" d="M403 0L403 47L289 47L289 639L403 639L403 686C362 683 264 683 218 683C172 683 74 683 33 686L33 639L147 639L147 47L33 47L33 0C74 3 172 3 218 3C264 3 362 3 403 0Z"/></g></g><g data-mml-node="mi" transform="translate(469,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\odot" transform="translate(7914.1,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="msub" data-latex="\tilde{\mathbf{C}}_t" transform="translate(8918.4,0)"><g data-mml-node="TeXAtom" data-latex="\tilde{\mathbf{C}}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="mo" transform="translate(466.5,246) translate(-250 0)"><path data-c="2DC" d="M184 602C197 602 217 595 244 580C271 565 292 558 308 558C330 558 352 568 373 588C381 595 396 611 419 634L397 653L384 639C363 618 341 607 317 607C305 607 285 614 257 629C229 644 208 651 193 651C171 651 149 641 128 621C120 614 105 598 82 575L104 556C125 580 148 602 184 602Z"/></g></g></g><g data-mml-node="mi" transform="translate(864,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-774.5)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\mathbf{H}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="mi" transform="translate(933,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1238.3,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\mathbf{O}_t" transform="translate(1333.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g><g data-mml-node="mi" transform="translate(897,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\odot" transform="translate(2758,0)"><path data-c="2299" d="M94 249C94 412 227 545 390 545C553 545 686 412 686 249C686 86 553-47 390-47C227-47 94 86 94 249M49 249C49 60 202-93 391-93C580-93 733 60 733 249C733 438 580 591 391 591C202 591 49 438 49 249M335 250C335 219 360 194 391 194C422 194 447 219 447 250C447 281 422 306 391 306C360 306 335 281 335 250Z"/></g><g data-mml-node="mi" data-latex="\tanh" transform="translate(3762.3,0)"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(389,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(889,0)"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(1445,0)"/></g><g data-mml-node="mo" transform="translate(5763.3,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(5763.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{C}_t" transform="translate(6152.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{C}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="C"><path data-c="1D402" d="M766 227C766 247 759 248 742 248C729 248 720 248 719 231C712 97 591 36 490 36C412 36 328 60 276 121C229 178 217 253 217 343C217 399 220 507 283 573C348 639 435 650 487 650C595 650 690 574 712 447C715 428 716 426 739 426C765 426 766 428 766 454L766 669C766 688 766 697 748 697C739 697 737 695 729 688L663 629C601 679 534 697 466 697C217 697 64 548 64 343C64 138 217-11 466-11C653-11 766 112 766 227Z"/></g></g><g data-mml-node="mi" transform="translate(864,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7321.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<h2><a id="toc-fba" class="anchor" href="#toc-fba"></a>深度循环神经网络</h2><p>只讨论了具有一个单向隐藏层的循环神经网络，深度循环神经网络是将多层循环神经网络堆叠在一起的网络结构，隐藏层变成了多层结构。</p>
<p>计算公式如下（其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.626ex;" xmlns="http://www.w3.org/2000/svg" width="4.269ex" height="3.02ex" role="img" focusable="false" viewBox="0 -1057.9 1886.7 1334.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{H}_t^{(0)} = \mathbf{X}_t"><g data-mml-node="msubsup" data-latex="\mathbf{H}_t^{(0)}"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,529) scale(0.707)" data-latex="{(0)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="0" transform="translate(389,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(889,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(933,-269) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.12ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2263 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{H}_t^{(0)} = \mathbf{X}_t"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\mathbf{X}_t" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g><g data-mml-node="mi" transform="translate(902,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>）：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.895ex;" xmlns="http://www.w3.org/2000/svg" width="39.893ex" height="6.921ex" role="img" focusable="false" viewBox="0 -1779.5 17632.7 3059"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\mathbf{H}_t^{(l)} &amp;= \phi_l(\mathbf{H}_t^{(l-1)} \mathbf{W}_{xh}^{(l)} + \mathbf{H}_{t-1}^{(l)} \mathbf{W}_{hh}^{(l)}  + \mathbf{b}_h^{(l)}) \\
\mathbf{O}_t &amp;= \mathbf{H}_t^{(L)} \mathbf{W}_{hq} + \mathbf{b}_q
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\mathbf{H}_t^{(l)} &amp;= \phi_l(\mathbf{H}_t^{(l-1)} \mathbf{W}_{xh}^{(l)} + \mathbf{H}_{t-1}^{(l)} \mathbf{W}_{hh}^{(l)}  + \mathbf{b}_h^{(l)}) \\
\mathbf{O}_t &amp;= \mathbf{H}_t^{(L)} \mathbf{W}_{hq} + \mathbf{b}_q
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,721.6)"><g data-mml-node="mtd"><g data-mml-node="msubsup" data-latex="\mathbf{H}_t^{(l)}"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,529) scale(0.707)" data-latex="{(l)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(687,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(933,-269) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1743.8,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\phi_l" transform="translate(1333.6,0)"><g data-mml-node="mi" data-latex="\phi"><path data-c="1D719" d="M385 445C404 524 424 601 442 680L442 683C439 690 434 694 426 694C417 694 411 686 408 671L351 445C276 442 208 414 147 362C82 307 49 243 49 170C49 62 132-7 237-13C218-92 204-149 195-183C194-186 194-189 194-190C194-200 199-205 210-205C221-205 224-199 227-187L271-14C346-11 414 17 475 69C540 125 573 189 573 262C573 369 488 436 385 445M377 415C453 410 501 363 501 283C501 243 492 203 474 164C442 92 369 26 278 17M121 149C121 189 130 229 148 268C180 340 253 405 343 415L244 16C169 22 121 69 121 149Z"/></g><g data-mml-node="mi" transform="translate(629,-150) scale(0.707)" data-latex="l"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(2223.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf{H}_t^{(l-1)}" transform="translate(2612.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,529) scale(0.707)" data-latex="{(l-1)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(687,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1465,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1965,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(933,-269) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msubsup" data-latex="\mathbf{W}_{x h}^{(l)}" transform="translate(5259.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(l)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(687,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-317.1) scale(0.707)" data-latex="{x h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(572,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(7565.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf{H}_{t-1}^{(l)}" transform="translate(8566,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,529) scale(0.707)" data-latex="{(l)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(687,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,-297.3) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="msubsup" data-latex="\mathbf{W}_{h h}^{(l)}" transform="translate(10708,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(l)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(687,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-317.1) scale(0.707)" data-latex="{h h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(576,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(13016.8,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf{b}_h^{(l)}" transform="translate(14017,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(672,529) scale(0.707)" data-latex="{(l)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="l" transform="translate(389,0)"><path data-c="1D459" d="M173 632L49 119C46 105 44 93 44 84C44 31 83-11 136-11C185-11 220 41 241 145C241 154 236 159 225 159C217 159 211 152 208 138C188 59 165 19 138 19C121 19 113 33 113 60C113 75 115 91 119 107L258 679L258 683C255 690 249 694 242 694C210 694 136 685 124 684C109 682 102 674 102 659C102 650 111 645 130 645C147 645 173 645 173 632Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(687,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(672,-317.1) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(15499.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-992.3)"><g data-mml-node="mtd" transform="translate(541.6,0)"><g data-mml-node="msub" data-latex="\mathbf{O}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="1D40E" d="M799 339C799 555 654 697 432 697C203 697 64 549 64 339C64 132 204-11 431-11C661-11 799 134 799 339M646 354C646 284 642 195 600 126C555 53 485 31 431 31C372 31 299 59 258 135C225 197 217 268 217 354C217 418 220 503 264 571C305 632 372 657 431 657C495 657 564 629 604 563C642 499 646 422 646 354Z"/></g></g><g data-mml-node="mi" transform="translate(897,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mtd" transform="translate(1743.8,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf{H}_t^{(L)}" transform="translate(1333.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{H}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="H"><path data-c="1D407" d="M860 0L860 47L752 47L752 639L860 639L860 686C822 683 724 683 681 683C638 683 540 683 502 686L502 639L610 639L610 380L289 380L289 639L397 639L397 686C359 683 261 683 218 683C175 683 77 683 39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 333L610 333L610 47L502 47L502 0C540 3 638 3 681 3C724 3 822 3 860 0Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(933,529) scale(0.707)" data-latex="{(L)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="L" transform="translate(389,0)"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1070,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(933,-269) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="msub" data-latex="\mathbf{W}_{h q}" transform="translate(3348.2,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{W}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,-150) scale(0.707)" data-latex="{h q}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(576,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g><g data-mml-node="mo" data-latex="+" transform="translate(5569.4,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf{b}_q" transform="translate(6569.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{b}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="b"><path data-c="1D41B" d="M600 223C600 356 506 450 361 450C288 450 238 421 214 401L214 694L37 686L37 639C99 639 106 639 106 600L106 0L153 0C169 19 186 37 202 56C210 48 259-6 348-6C497-6 600 84 600 223M472 223C472 176 472 121 446 82C417 41 371 30 339 30C269 30 230 84 220 99L220 350C247 385 295 414 350 414C472 414 472 293 472 223Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/deep-rnn.svg" alt="deep-rnn.svg"></p>
<h2><a id="toc-5fe" class="anchor" href="#toc-5fe"></a>双向循环神经网络</h2><p>双向循环神经网络是一种同时考虑上文和下文的RNN，用于解决完形填空类的序列预测问题。相比普通的RNN只有基于上文的隐状态，它还引入了基于下文的隐状态：</p>
<p class="firekylin-markdown-img-only"><img src="/static/upload/20260725/birnn.svg" alt="birnn.svg"></p>
<p><strong>这一设计基于如下数学理论：</strong></p>
<p>考虑一个隐马尔可夫模型的概率图模型：在任意时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.817ex" height="1.441ex" role="img" focusable="false" viewBox="0 -626 361 637"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></svg></mjx-container></span>，假设存在某个隐变量<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.068ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 914.3 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t"><g data-mml-node="msub" data-latex="h_t"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>，通过概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.645ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2053.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid h_t)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.206ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1859 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_t \mid h_t)"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1470,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>控制我们观测到的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.059ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 910.3 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_t"><g data-mml-node="msub" data-latex="x_t"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>，且任何<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.068ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 914.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t \to h_{t+1}"><g data-mml-node="msub" data-latex="h_t"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.004ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3095.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t \to h_{t+1}"><g data-mml-node="mo" data-latex="\to"><path data-c="2192" d="M932 234C939 237 943 243 943 250C943 257 939 263 932 266C884 282 839 316 797 368C769 403 750 444 741 491C738 504 730 510 717 510C701 510 693 502 693 485L694 483L694 482C711 395 755 326 828 274L82 274C66 274 58 266 58 250C58 234 66 226 82 226L828 226C755 174 711 105 694 18L694 17L693 15C693-2 701-10 717-10C730-10 738-4 741 9C750 56 769 97 797 132C839 184 884 218 932 234Z"/></g><g data-mml-node="msub" data-latex="h_{t+1}" transform="translate(1277.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(361,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>的转移都由状态转移概率<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.699ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2960.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(h_{t+1} \mid h_{t})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_{t+1}" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(361,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.206ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1859 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(h_{t+1} \mid h_{t})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t}" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1470,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>给出。<strong>简单来说就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.059ex" height="1.357ex" role="img" focusable="false" viewBox="0 -442 910.3 599.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_t"><g data-mml-node="msub" data-latex="x_t"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>只与<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.068ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 914.3 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t"><g data-mml-node="msub" data-latex="h_t"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>有关，<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.472ex;" xmlns="http://www.w3.org/2000/svg" width="4.113ex" height="2.042ex" role="img" focusable="false" viewBox="0 -694 1817.9 902.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_{t+1}"><g data-mml-node="msub" data-latex="h_{t+1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(361,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>只与<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.068ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 914.3 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_t"><g data-mml-node="msub" data-latex="h_t"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>有关。</strong></p>
<p>于是，模型（联合概率分布）就可以通过下式表达：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -6.448ex;" xmlns="http://www.w3.org/2000/svg" width="76.973ex" height="14.027ex" role="img" focusable="false" viewBox="0 -3350 34021.9 6200"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
P(x_1, \ldots, x_T, h_1, \ldots, h_T)
=&amp;P(h_1)P(x_1|h_1) \cdot \\
&amp; P(h_2|h_1,x_1)P(x_2|h_1,h_2,x_1) \cdot \\
&amp; P(h_3|h_1,h_2,x_1,x_2)P(x_3|h_1,h_2,h_3,x_1,x_2) \cdot \\
&amp;\dots \\
&amp; P(h_T|h_1\dots h_{T-1},x_1\dots x_{T-1})P(x_T|h_1\dots h_T,x_1\dots x_{T-1})
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
P(x_1 , \ldots, x_T, h_1 , \ldots, h_T)
=&amp;P(h_1 )P(x_1 |h_1 ) \cdot \\
&amp; P(h_2 |h_1 ,x_1 )P(x_2 |h_1 ,h_2 ,x_1 ) \cdot \\
&amp; P(h_3 |h_1 ,h_2 ,x_1 ,x_2 )P(x_3 |h_1 ,h_2 ,h_3 ,x_1 ,x_2 ) \cdot \\
&amp;\dots \\
&amp; P(h_T|h_1 \dots h_{T-1},x_1 \dots x_{T-1})P(x_T|h_1 \dots h_T,x_1 \dots x_{T-1})
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,2600)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2596.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3599.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4044.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5197.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(5642,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(6654.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(7099.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(8102.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(8547.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(9704.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(10371.2,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="mtd" transform="translate(11149.2,0)"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2155.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(2544.6,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3298.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(3687.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(4696.1,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(4974.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5986.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(6375.7,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,1300)"><g data-mml-node="mtd" transform="translate(11149.2,0)"/><g data-mml-node="mtd" transform="translate(11149.2,0)"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_2" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(2155.6,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(2433.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3446.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(3890.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4899.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(5288.3,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(6042.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(6431.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(7439.9,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(7717.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(8730.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_2" transform="translate(9175.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(10187.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(10632.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11640.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(12029.9,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,0)"><g data-mml-node="mtd" transform="translate(11149.2,0)"/><g data-mml-node="mtd" transform="translate(11149.2,0)"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_3" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(2155.6,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(2433.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3446.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_2" transform="translate(3890.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(4903.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(5348,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(6356.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(6801.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7809.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(8198.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(8952.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_3" transform="translate(9341.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(10350.3,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(10628.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(11640.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_2" transform="translate(12085.5,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(13098.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_3" transform="translate(13542.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="3"><path data-c="33" d="M303 353C369 378 431 441 431 526C431 569 410 604 369 631C333 654 292 666 246 666C201 666 162 654 127 631C88 605 68 571 68 528C68 495 90 472 122 472C154 472 176 495 176 527C176 560 157 578 119 580C145 615 186 633 242 633C302 633 332 598 332 527C332 485 324 450 309 421C282 373 245 364 183 364C171 362 165 357 165 348C165 333 172 333 192 333L235 333C310 333 348 280 348 173C348 88 317 14 241 14C176 14 128 36 99 80C134 79 160 105 160 139C160 173 135 198 101 198C62 198 42 178 42 137C42 88 64 49 108 18C147-9 193-22 244-22C301-22 350-3 393 34C436 71 457 117 457 173C457 267 383 332 303 353Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(14555.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(15000,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(16008.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_2" transform="translate(16453.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(17461.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(17850.8,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1300)"><g data-mml-node="mtd" transform="translate(11149.2,0)"/><g data-mml-node="mtd" transform="translate(11149.2,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" transform="translate(166.7,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-2600)"><g data-mml-node="mtd" transform="translate(11149.2,0)"/><g data-mml-node="mtd" transform="translate(11149.2,0)"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(2299.8,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(2577.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" transform="translate(3757,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="h_{T-1}" transform="translate(4760.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(6821.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(7265.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" transform="translate(8441.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="x_{T-1}" transform="translate(9444.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11501.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(11890.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(12644.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(13033.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(14186,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(14464,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" transform="translate(15643.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(16646.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(17803.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(18248.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" transform="translate(19423.6,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="x_{T-1}" transform="translate(20427.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(704,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1482,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(22483.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>由于一阶马尔可夫性质：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.036ex;" xmlns="http://www.w3.org/2000/svg" width="33.032ex" height="5.204ex" role="img" focusable="false" viewBox="0 -1400 14600 2300"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
&amp;P(h_t|\text{所有前置变量})=P(h_t|h_{t-1}) \\
&amp;P(x_t|\text{所有变量})=P(x_t|h_t)
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
&amp;P(h_t|\text{所有前置变量})=P(h_t|h_{t-1}) \\
&amp;P(x_t|\text{所有变量})=P(x_t|h_t)
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,650)"><g data-mml-node="mtd"/><g data-mml-node="mtd"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(2057.3,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mtext" data-latex="\text{所有前置变量}" transform="translate(2335.3,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">所有前置变量</text></g><g data-mml-node="mo" data-latex=")" transform="translate(8335.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(9002,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(10057.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(10811.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(11200.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(12115.1,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(12393.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(14211,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-650)"><g data-mml-node="mtd"/><g data-mml-node="mtd"><g data-mml-node="mstyle"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(2053.3,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="mtext" data-latex="\text{所有变量}" transform="translate(2331.3,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">所有变量</text></g><g data-mml-node="mo" data-latex=")" transform="translate(6331.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(6998,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(8053.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(8807.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(9196.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(10107.1,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(10385.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11299.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>可以得到模型：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="77.138ex" height="6.616ex" role="img" focusable="false" viewBox="0 -1728.7 34094.9 2924.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, \ldots, x_T, h_1, \ldots, h_T) = \prod_{t=1}^T P(h_t \mid h_{t-1}) P(x_t \mid h_t), \text{ where } P(h_1 \mid h_0) = P(h_1)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2596.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3599.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4044.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5197.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(5642,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(6654.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(7099.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(8102.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(8547.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(9704.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(10371.2,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=1}^T" transform="translate(11426.9,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(390.1,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(12871.6,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(13625.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(14014.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(15206.6,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(15762.4,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(17580.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(17969.4,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(18723.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(19112.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(20300.4,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(20856.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(21770.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(22159.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mtext" data-latex="\text{ where }" transform="translate(22604.1,0)"><path data-c="A0" d=""/><path data-c="77" d="M620 332C634 371 662 392 703 393L703 431C672 428 646 427 627 428L531 431L531 393C569 392 588 377 588 349C588 345 587 339 584 330L497 89L403 353C400 362 399 367 399 370C399 385 418 393 457 393L457 431L350 428C330 427 299 428 258 431L258 393C293 393 314 388 321 379C324 376 332 359 343 328L262 102L172 354C169 363 167 368 167 370C167 385 187 393 226 393L226 431L114 428L18 431L18 393C67 393 80 394 91 361L216 13C222-3 230-11 240-11C251-11 259-4 264 11L360 279L457 10C462-4 470-11 481-11C488-10 496-3 504 10Z" transform="translate(332,0)"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(1054,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1610,0)"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(2054,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(2446,0)"/><path data-c="A0" d="" transform="translate(2890,0)"/></g><g data-mml-node="mi" data-latex="P" transform="translate(25826.1,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(26580.1,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(26969.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(28259.5,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_0" transform="translate(28815.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="0"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(29827.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(30494.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(31550.3,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(32304.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(32693.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(33705.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>再来考虑我们的问题，实际上我们的目标是计算<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="4.727ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2089.3 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.523ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2441.2 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j})"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2052.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，也就是在已知<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.141ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 946.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_j"><g data-mml-node="msub" data-latex="x_j"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>以外的所有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="24.593ex" height="2.36ex" role="img" focusable="false" viewBox="0 -748 10870 1043"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="(x_1, \ldots, x_{j-1}, x_{j+1}, \ldots, x_{T})"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(389,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1397.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(1842.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(2845.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{j-1}" transform="translate(3290.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(5140.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{j+1}" transform="translate(5585.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(7435.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(7879.9,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(8883.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_{T}" transform="translate(9328.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{T}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(10481,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>的情况下<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.141ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 946.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_j"><g data-mml-node="msub" data-latex="x_j"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>的概率。由贝叶斯公式，<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="4.727ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2089.3 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j})=\frac{P(x_j,\,x_{-j})}{P(x_{-j})}"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.523ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 2441.2 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j})=\frac{P(x_j,\,x_{-j})}{P(x_{-j})}"><g data-mml-node="mo" data-latex="\mid"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(555.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2052.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.307ex;" xmlns="http://www.w3.org/2000/svg" width="10.565ex" height="3.744ex" role="img" focusable="false" viewBox="0 -1077.5 4670 1655"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j})=\frac{P(x_j,\,x_{-j})}{P(x_{-j})}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{P(x_j,\,x_{-j})}{P(x_{-j})}" transform="translate(1055.8,0)"><g data-mml-node="mrow" transform="translate(220,548.6) scale(0.707)" data-latex="P(x_j,\,x_{-j})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2089.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mstyle" transform="translate(2367.3,0) scale(1.414)" data-latex="\,"><g data-mml-node="mspace"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(2603.5,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4100,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(736.4,-368.9) scale(0.707)" data-latex="P(x_{-j})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2639.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="3374.2" height="60" x="120" y="220"/></g></g></g></svg></mjx-container></span>，其中分母<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="6.852ex" height="2.36ex" role="img" focusable="false" viewBox="0 -748 3028.5 1043"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_{-j})"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2639.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>是不依赖<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.141ex" height="1.667ex" role="img" focusable="false" viewBox="0 -442 946.3 737"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x_j"><g data-mml-node="msub" data-latex="x_j"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>的常数，所以本质上我们要求的还是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="12.639ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 5586.4 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1,\dots,x_T)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" transform="translate(2596.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3599.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4044.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5197.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>。</p>
<p>为了求解它，需要把隐变量边缘化：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -3.041ex;" xmlns="http://www.w3.org/2000/svg" width="44.568ex" height="5.191ex" role="img" focusable="false" viewBox="0 -950 19698.9 2294.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, \ldots, x_T) = \sum_{h_1, \ldots, h_T} P(x_1, \ldots, x_T, h_1, \ldots, h_T)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2596.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3599.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4044.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5197.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(5864.1,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_1,\ldots,h_T}" transform="translate(6919.9,0)"><g data-mml-node="mo" data-latex="\sum" transform="translate(537.5,0)"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1107.7) scale(0.707)" data-latex="{h_1,\ldots,h_T}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_1"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1012.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(1290.6,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(2127.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(2405.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(9605.5,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(10359.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(10748.5,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(11757.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(12201.8,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(13205.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(13650.1,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(14802.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(15247.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(16260.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(16704.8,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(17708.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(18153.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(19309.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>在边缘化之前，我们先对模型改写：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -6.136ex;" xmlns="http://www.w3.org/2000/svg" width="92.24ex" height="10.156ex" role="img" focusable="false" viewBox="0 -1776.9 40770 4489.1"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_{1:T},h_{1:T})
=\underbrace{\Big(P(h_1)\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\Big)}_{\text{只和}h_1\dots h_j,\;x_{1:j-1}\text{有关}}
\cdot P(x_j|h_j)
\cdot \underbrace{\Big(\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\Big)}_{\text{只和}h_j,h_{j+1}\dots h_T,\;x_{j+1:T}\text{有关}}"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{1:T}" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{1:T}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(500,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(778,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2845.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{1:T}" transform="translate(3290.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{1:T}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(500,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(778,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4997.5,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(5664.3,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\underbrace{\Big(P(h_1)\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\Big)}_{\text{只和}h_1h_j,\;x_{1:j-1}\text{有关}}" transform="translate(6720.1,0)"><g data-mml-node="TeXAtom" data-latex="\underbrace{\Big(P(h_1)\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\Big)}" data-mjx-texclass="OP"><g data-mml-node="munder"><g data-mml-node="mrow" data-latex="\Big(P(h_1 )\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\Big)"><g data-mml-node="TeXAtom" data-latex="\Big(" data-mjx-texclass="ORD"><g data-mml-node="mo"><path data-c="28" d="M521-646C533-646 539-640 539-628C539-622 537-617 533-613C446-546 376-432 324-271C279-134 257 1 257 133L257 367C257 499 279 634 324 771C376 932 446 1046 533 1113C537 1117 539 1122 539 1128C539 1140 533 1146 521 1146C519 1146 516 1145 511 1144C412 1068 331 950 267 791C208 644 179 502 179 367L179 133C179-2 208-144 267-291C331-450 412-568 511-644C516-645 519-646 521-646Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(597,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1351,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(1740,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2752.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=2}^{j}" transform="translate(3308.2,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=2}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1139,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(493.3,1206) scale(0.707)" data-latex="{j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(4752.9,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(5506.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(5895.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(6810.2,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(7088.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(8906.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=1}^{j-1}" transform="translate(9461.8,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(41.5,1206) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(10906.4,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(11660.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(12049.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(12959.7,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(13237.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(14152,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="TeXAtom" data-latex="\Big)" data-mjx-texclass="ORD" transform="translate(14541,0)"><g data-mml-node="mo"><path data-c="29" d="M86-644C185-568 266-450 330-291C389-144 418-2 418 133L418 367C418 502 389 644 330 791C266 950 185 1068 86 1144C81 1145 78 1146 76 1146C64 1146 58 1140 58 1128C58 1122 60 1117 64 1113C151 1046 221 932 273 771C318 634 340 499 340 367L340 133C340 1 318-134 273-271C221-432 151-546 64-613C60-617 58-622 58-628C58-640 64-646 76-646C78-646 81-645 86-644Z"/></g></g></g><g data-mml-node="mo" transform="translate(0,-1196.8)"><path data-c="23DF" d="M510-294L1002-294L1002-188L510-188C385-188 277-179 188-160C99-141 47-112 32-73C29-66 24-62 17-62C6-62 0-67 0-78C0-81 0-84 1-85C26-151 100-204 225-245C325-278 420-294 510-294Z"/><path data-c="23DF" d="M1000-85C1001-84 1001-81 1001-78C1001-67 995-62 984-62C977-62 971-66 968-73C954-112 902-141 813-160C724-179 616-188 491-188L0-188L0-294L491-294C581-294 676-278 776-245C901-204 975-151 1000-85Z" transform="translate(14137,0)"/><path data-c="23DF" d="M1496-294L2003-294L2003-188L1496-188C1407-188 1317-200 1228-224C1115-255 1039-298 1001-355C963-298 887-255 774-224C685-200 595-188 506-188L0-188L0-294L506-294C649-294 765-303 854-321C941-338 984-366 984-403C984-414 990-419 1001-419C1012-419 1018-414 1018-403C1018-366 1062-338 1150-320C1238-302 1353-294 1496-294Z" transform="translate(6567.5,0)"/><svg width="5705.5" height="246" x="932" y="-364" viewBox="1426.4 -364 5705.5 246" xmlns="http://www.w3.org/2000/svg"><path data-c="5F" d="M0-294L994-294L994-188L0-188Z" transform="scale(8.61,1)"/></svg><svg width="5706.5" height="246" x="8500.5" y="-364" viewBox="1426.6 -364 5706.5 246" xmlns="http://www.w3.org/2000/svg"><path data-c="5F" d="M0-294L994-294L994-188L0-188Z" transform="scale(8.611,1)"/></svg></g></g></g><g data-mml-node="TeXAtom" transform="translate(4079,-2266.5) scale(0.707)" data-latex="{\text{只和}h_1h_j,\;x_{1:j-1}\text{有关}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{只和}"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">只和</text></g><g data-mml-node="msub" data-latex="h_1" transform="translate(2000,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" transform="translate(3012.6,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(3849.6,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(4799.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mstyle" transform="translate(5077.9,0) scale(1.414)" data-latex="\;"><g data-mml-node="mspace"/></g><g data-mml-node="msub" data-latex="x_{1:j-1}" transform="translate(5471,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{1:j-1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(500,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1190,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1968,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mtext" data-latex="\text{有关}" transform="translate(7871.2,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">有关</text></g></g></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(22024.7,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(22302.7,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(23056.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(23445.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(24392,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(24670,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(25620.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(26231.6,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g><g data-mml-node="munder" data-latex="\underbrace{\Big(\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\Big)}_{\text{只和}h_j,h_{j+1}h_T,\;x_{j+1:T}\text{有关}}" transform="translate(26731.8,0)"><g data-mml-node="TeXAtom" data-latex="\underbrace{\Big(\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\Big)}" data-mjx-texclass="OP"><g data-mml-node="munder"><g data-mml-node="mrow" data-latex="\Big(\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\Big)"><g data-mml-node="TeXAtom" data-latex="\Big(" data-mjx-texclass="ORD"><g data-mml-node="mo"><path data-c="28" d="M521-646C533-646 539-640 539-628C539-622 537-617 533-613C446-546 376-432 324-271C279-134 257 1 257 133L257 367C257 499 279 634 324 771C376 932 446 1046 533 1113C537 1117 539 1122 539 1128C539 1140 533 1146 521 1146C519 1146 516 1145 511 1144C412 1068 331 950 267 791C208 644 179 502 179 367L179 133C179-2 208-144 267-291C331-450 412-568 511-644C516-645 519-646 521-646Z"/></g></g><g data-mml-node="munderover" data-latex="\prod_{t=j+1}^T" transform="translate(763.7,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(361.2,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{t=j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1139,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1551,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2329,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(751.3,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(2930.7,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3684.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(4073.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(4988,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(5266,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7084,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=j+1}^T" transform="translate(7639.6,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(361.2,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{t=j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1139,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1551,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2329,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(751.3,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(9806.7,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(10560.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(10949.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(11860,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(12138,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13052.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="TeXAtom" data-latex="\Big)" data-mjx-texclass="ORD" transform="translate(13441.2,0)"><g data-mml-node="mo"><path data-c="29" d="M86-644C185-568 266-450 330-291C389-144 418-2 418 133L418 367C418 502 389 644 330 791C266 950 185 1068 86 1144C81 1145 78 1146 76 1146C64 1146 58 1140 58 1128C58 1122 60 1117 64 1113C151 1046 221 932 273 771C318 634 340 499 340 367L340 133C340 1 318-134 273-271C221-432 151-546 64-613C60-617 58-622 58-628C58-640 64-646 76-646C78-646 81-645 86-644Z"/></g></g></g><g data-mml-node="mo" transform="translate(0,-1333.9)"><path data-c="23DF" d="M510-294L1002-294L1002-188L510-188C385-188 277-179 188-160C99-141 47-112 32-73C29-66 24-62 17-62C6-62 0-67 0-78C0-81 0-84 1-85C26-151 100-204 225-245C325-278 420-294 510-294Z"/><path data-c="23DF" d="M1000-85C1001-84 1001-81 1001-78C1001-67 995-62 984-62C977-62 971-66 968-73C954-112 902-141 813-160C724-179 616-188 491-188L0-188L0-294L491-294C581-294 676-278 776-245C901-204 975-151 1000-85Z" transform="translate(13037.2,0)"/><path data-c="23DF" d="M1496-294L2003-294L2003-188L1496-188C1407-188 1317-200 1228-224C1115-255 1039-298 1001-355C963-298 887-255 774-224C685-200 595-188 506-188L0-188L0-294L506-294C649-294 765-303 854-321C941-338 984-366 984-403C984-414 990-419 1001-419C1012-419 1018-414 1018-403C1018-366 1062-338 1150-320C1238-302 1353-294 1496-294Z" transform="translate(6017.6,0)"/><svg width="5155.6" height="246" x="932" y="-364" viewBox="1288.9 -364 5155.6 246" xmlns="http://www.w3.org/2000/svg"><path data-c="5F" d="M0-294L994-294L994-188L0-188Z" transform="scale(7.78,1)"/></svg><svg width="5156.6" height="246" x="7950.6" y="-364" viewBox="1289.2 -364 5156.6 246" xmlns="http://www.w3.org/2000/svg"><path data-c="5F" d="M0-294L994-294L994-188L0-188Z" transform="scale(7.782,1)"/></svg></g></g></g><g data-mml-node="TeXAtom" transform="translate(2673.3,-2403.6) scale(0.707)" data-latex="{\text{只和}h_j,h_{j+1}h_T,\;x_{j+1:T}\text{有关}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{只和}"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">只和</text></g><g data-mml-node="msub" data-latex="h_j" transform="translate(2000,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2950.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_{j+1}" transform="translate(3228.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" transform="translate(5082.3,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="msub" data-latex="h_T" transform="translate(5919.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(7076.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mstyle" transform="translate(7354.1,0) scale(1.414)" data-latex="\;"><g data-mml-node="mspace"/></g><g data-mml-node="msub" data-latex="x_{j+1:T}" transform="translate(7747.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j+1:T}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(1690,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(1968,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g><g data-mml-node="mtext" data-latex="\text{有关}" transform="translate(10291.7,0)"><text data-variant="normal" transform="scale(1,-1)" font-size="884px" font-family="serif">有关</text></g></g></g></g></g></svg></mjx-container></span></p>
<p>于是，我们可以用递推的方式，通过前向和后向分别边缘化<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.439ex" height="2.237ex" role="img" focusable="false" viewBox="0 -694 2404.1 989"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_{1:j-1}"><g data-mml-node="msub" data-latex="h_{1:j-1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{1:j-1}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(500,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1190,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1968,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="5.766ex" height="2.237ex" role="img" focusable="false" viewBox="0 -694 2548.4 989"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_{j+1:T}"><g data-mml-node="msub" data-latex="h_{j+1:T}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1:T}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=":" transform="translate(1690,0)"><path data-c="3A" d="M192 375C192 405 169 431 139 431C109 431 86 405 86 375C86 345 109 319 139 319C169 319 192 345 192 375M192 56C192 86 169 112 139 112C109 112 86 86 86 56C86 26 109 0 139 0C169 0 192 26 192 56Z"/></g><g data-mml-node="mi" data-latex="T" transform="translate(1968,0)"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g></g></svg></mjx-container></span>，令：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -6.968ex;" xmlns="http://www.w3.org/2000/svg" width="95.414ex" height="15.067ex" role="img" focusable="false" viewBox="0 -3579.7 42172.9 6659.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
\pi_j(h_j)&amp;=\sum_{h_{j-1}} \pi_{j-1}(h_{j-1}) P(x_{j-1} \mid h_{j-1}) P(h_{j} \mid h_{j-1})=\sum_{h_1}\dots\sum_{h_{j-1}}
\left[P(h_1)\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\right]
\\
\rho_j(h_j)&amp;=\sum_{h_{j+1}} P(h_{j+1} \mid h_{j}) P(x_{j+1} \mid h_{j+1}) \rho_{j+1}(h_{j+1})=\sum_{h_{j+1}}\dots\sum_{h_T}
\left[\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\right]
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
\pi_j(h_j)&amp;=\sum_{h_{j-1}} \pi_{j-1}(h_{j-1}) P(x_{j-1} \mid h_{j-1}) P(h_{j} \mid h_{j-1})=\sum_{h_1 }\dots\sum_{h_{j-1}}
\left[P(h_1 )\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\right]
\\
\rho_j(h_j)&amp;=\sum_{h_{j+1}} P(h_{j+1} \mid h_{j}) P(x_{j+1} \mid h_{j+1}) \rho_{j+1}(h_{j+1})=\sum_{h_{j+1}}\dots\sum_{h_T}
\left[\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\right]
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1802.9)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\pi_j"><g data-mml-node="mi" data-latex="\pi"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g><g data-mml-node="mi" transform="translate(603,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(944.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(1333.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2283.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(2672.7,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_{j-1}}" transform="translate(1333.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(66.5,-1107.7) scale(0.707)" data-latex="{h_{j-1}}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_{j-1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="msub" data-latex="\pi_{j-1}" transform="translate(2944.2,0)"><g data-mml-node="mi" data-latex="\pi"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g><g data-mml-node="TeXAtom" transform="translate(603,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(4792.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_{j-1}" transform="translate(5181.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7035.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(7424.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(8178.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{j-1}" transform="translate(8567.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(10695,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{j-1}" transform="translate(11250.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13104.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(13493.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(14247.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_{j}" transform="translate(14636.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(15864.9,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{j-1}" transform="translate(16420.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(18274.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(18941.5,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_1}" transform="translate(19997.3,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(364,-1107.7) scale(0.707)" data-latex="{h_1}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_1"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mo" transform="translate(21607.9,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_{j-1}}" transform="translate(22611.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(66.5,-1107.7) scale(0.707)" data-latex="{h_{j-1}}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_{j-1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mrow" data-latex="\left[P(h_1 )\prod_{t=2}^{j}P(h_t|h_{t-1})\prod_{t=1}^{j-1}P(x_t|h_t)\right]" transform="translate(24222.3,0)"><g data-mml-node="mo" data-latex="\left["><path data-c="5B" d="M614-1182L387-1182L387 1682L614 1682C636 1682 647 1693 647 1716C647 1739 636 1750 614 1750L321 1750L321-1250L614-1250C636-1250 647-1239 647-1216C647-1197 633-1182 614-1182Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(667,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1421,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_1" transform="translate(1810,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mn" transform="translate(609,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2822.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=2}^{j}" transform="translate(3378.2,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=2}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1139,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(493.3,1206) scale(0.707)" data-latex="{j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(4822.9,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(5576.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(5965.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(6880.2,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(7158.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(8976.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=1}^{j-1}" transform="translate(9531.8,0)"><g data-mml-node="mo" data-latex="\prod"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(59.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(41.5,1206) scale(0.707)" data-latex="{j-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(412,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(10976.4,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(11730.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(12119.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(13029.7,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(13307.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(14222,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\right]" transform="translate(14611,0)"><path data-c="5D" d="M53-1250L346-1250L346 1750L53 1750C31 1750 20 1739 20 1716C20 1693 31 1682 53 1682L280 1682L280-1182L53-1182C31-1182 20-1193 20-1216C20-1239 31-1250 53-1250Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1663.4)"><g data-mml-node="mtd" transform="translate(53,0)"><g data-mml-node="msub" data-latex="\rho_j"><g data-mml-node="mi" data-latex="\rho"><path data-c="1D70C" d="M361 442C248 442 154 320 129 220L33-169C31-177 30-182 30-185C30-206 40-216 61-216C76-216 89-208 99-193L160 46C183 7 215-13 256-13C322-13 380 19 431 84C478 145 502 210 502 277C502 368 449 442 361 442M359 412C402 412 423 381 423 319C423 292 417 257 406 212C384 127 353 70 314 40C293 24 274 16 255 16C236 16 219 23 206 36C185 57 175 79 175 100C176 107 178 119 182 136C205 231 225 292 241 320C276 381 315 412 359 412Z"/></g><g data-mml-node="mi" transform="translate(550,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(891.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(1280.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2230.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(2672.7,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_{j+1}}" transform="translate(1333.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(66.5,-1107.7) scale(0.707)" data-latex="{h_{j+1}}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_{j+1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mi" data-latex="P" transform="translate(2944.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3698.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_{j+1}" transform="translate(4087.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(6219,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{j}" transform="translate(6774.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7725.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(8114.1,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(8868.1,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_{j+1}" transform="translate(9257.1,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(11384.9,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{j+1}" transform="translate(11940.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(13794.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\rho_{j+1}" transform="translate(14183.7,0)"><g data-mml-node="mi" data-latex="\rho"><path data-c="1D70C" d="M361 442C248 442 154 320 129 220L33-169C31-177 30-182 30-185C30-206 40-216 61-216C76-216 89-208 99-193L160 46C183 7 215-13 256-13C322-13 380 19 431 84C478 145 502 210 502 277C502 368 449 442 361 442M359 412C402 412 423 381 423 319C423 292 417 257 406 212C384 127 353 70 314 40C293 24 274 16 255 16C236 16 219 23 206 36C185 57 175 79 175 100C176 107 178 119 182 136C205 231 225 292 241 320C276 381 315 412 359 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(550,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(15978.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_{j+1}" transform="translate(16367.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(18221.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(18888.5,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_{j+1}}" transform="translate(19944.3,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(66.5,-1107.7) scale(0.707)" data-latex="{h_{j+1}}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_{j+1}"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(412,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g><g data-mml-node="mo" transform="translate(21554.9,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_T}" transform="translate(22558.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(313,-1107.7) scale(0.707)" data-latex="{h_T}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_T"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g></g></g><g data-mml-node="mrow" data-latex="\left[\prod_{t=j+1}^T P(h_t|h_{t-1})\prod_{t=j+1}^T P(x_t|h_t)\right]" transform="translate(24169.3,0)"><g data-mml-node="mo" data-latex="\left["><path data-c="5B" d="M614-1182L387-1182L387 1682L614 1682C636 1682 647 1693 647 1716C647 1739 636 1750 614 1750L321 1750L321-1250L614-1250C636-1250 647-1239 647-1216C647-1197 633-1182 614-1182Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=j+1}^T" transform="translate(667,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(361.2,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{t=j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1139,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1551,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2329,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(751.3,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(2834.1,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3588.1,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(3977.1,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(4891.3,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_{t-1}" transform="translate(5169.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="TeXAtom" transform="translate(609,-150) scale(0.707)" data-latex="{t-1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(361,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6987.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="munderover" data-latex="\prod_{t=j+1}^T" transform="translate(7543,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(361.2,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{t=j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1139,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1551,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2329,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(751.3,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="P" transform="translate(9710,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(10464,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_t" transform="translate(10853,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex="|" transform="translate(11763.3,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_t" transform="translate(12041.3,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12955.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\right]" transform="translate(13344.6,0)"><path data-c="5D" d="M53-1250L346-1250L346 1750L53 1750C31 1750 20 1739 20 1716C20 1693 31 1682 53 1682L280 1682L280-1182L53-1182C31-1182 20-1193 20-1216C20-1239 31-1250 53-1250Z"/></g></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>我们得到对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.15ex" height="2.237ex" role="img" focusable="false" viewBox="0 -694 950.3 989"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_j"><g data-mml-node="msub" data-latex="h_j"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>以外的隐变量边缘化的结果：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="43.698ex" height="2.364ex" role="img" focusable="false" viewBox="0 -750 19314.3 1045"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_1, \ldots, x_T, h_j)=\pi_j(h_j) \cdot P(x_j \mid h_j)\cdot \rho_j(h_j)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2151.6,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2596.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3599.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(4044.6,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5197.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(5642,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6592.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(7259.1,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="\pi_j" transform="translate(8314.9,0)"><g data-mml-node="mi" data-latex="\pi"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g><g data-mml-node="mi" transform="translate(603,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(9259.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(9648.2,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(10598.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(11209.8,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(11710,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(12464,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(12853,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(14077.1,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(14632.9,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(15583.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\cdot" transform="translate(16194.4,0)"><path data-c="22C5" d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z"/></g><g data-mml-node="msub" data-latex="\rho_j" transform="translate(16694.7,0)"><g data-mml-node="mi" data-latex="\rho"><path data-c="1D70C" d="M361 442C248 442 154 320 129 220L33-169C31-177 30-182 30-185C30-206 40-216 61-216C76-216 89-208 99-193L160 46C183 7 215-13 256-13C322-13 380 19 431 84C478 145 502 210 502 277C502 368 449 442 361 442M359 412C402 412 423 381 423 319C423 292 417 257 406 212C384 127 353 70 314 40C293 24 274 16 255 16C236 16 219 23 206 36C185 57 175 79 175 100C176 107 178 119 182 136C205 231 225 292 241 320C276 381 315 412 359 412Z"/></g><g data-mml-node="mi" transform="translate(550,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(17586,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(17975,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(18925.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>最后再对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="2.15ex" height="2.237ex" role="img" focusable="false" viewBox="0 -694 950.3 989"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h_j"><g data-mml-node="msub" data-latex="h_j"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></svg></mjx-container></span>边缘化，我们有：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -3.204ex;" xmlns="http://www.w3.org/2000/svg" width="54.812ex" height="5.354ex" role="img" focusable="false" viewBox="0 -950 24227 2366.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="P(x_j \mid x_{-j}) \propto P(x_1, \ldots, x_T) = \sum_{h_j} \pi_j(h_j) \rho_j(h_j) P(x_j \mid h_j)"><g data-mml-node="mi" data-latex="P"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(754,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(1143,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(2367.1,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="x_{-j}" transform="translate(2922.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="TeXAtom" transform="translate(605,-150) scale(0.707)" data-latex="{-j}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(778,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4419.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\propto" transform="translate(5086.1,0)"><path data-c="221D" d="M462 277C435 317 407 351 380 379C340 421 291 442 232 442C177 442 132 417 99 367C70 324 56 273 56 215C56 157 70 106 98 63C131 14 175-11 230-11C338-11 412 72 453 154C480 114 507 80 534 52C575 10 624-11 682-11C695-11 709-9 722-6L722 41C707 38 698 37 695 37C659 37 626 53 596 85C577 106 555 136 530 173L488 235C504 271 528 307 559 344C595 385 639 406 691 406C701 406 711 404 722 401C722 423 720 436 717 439C710 441 699 442 684 442C577 442 502 359 462 277M385 258L426 196C410 160 386 124 355 87C319 46 275 25 223 25C178 25 143 46 118 89C97 125 86 167 86 215C86 260 97 299 118 334C143 374 177 394 219 394C256 394 289 378 318 346C337 325 360 295 385 258Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(6141.9,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(6895.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_1" transform="translate(7284.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mn" transform="translate(605,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(8293.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(8738.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(9741.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="x_T" transform="translate(10186.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11339.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(12006,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munder" data-latex="\sum_{h_j}" transform="translate(13061.8,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(386,-1107.7) scale(0.707)" data-latex="{h_j}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="h_j"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g><g data-mml-node="msub" data-latex="\pi_j" transform="translate(14672.5,0)"><g data-mml-node="mi" data-latex="\pi"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g><g data-mml-node="mi" transform="translate(603,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(15616.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(16005.8,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(16956.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\rho_j" transform="translate(17345.1,0)"><g data-mml-node="mi" data-latex="\rho"><path data-c="1D70C" d="M361 442C248 442 154 320 129 220L33-169C31-177 30-182 30-185C30-206 40-216 61-216C76-216 89-208 99-193L160 46C183 7 215-13 256-13C322-13 380 19 431 84C478 145 502 210 502 277C502 368 449 442 361 442M359 412C402 412 423 381 423 319C423 292 417 257 406 212C384 127 353 70 314 40C293 24 274 16 255 16C236 16 219 23 206 36C185 57 175 79 175 100C176 107 178 119 182 136C205 231 225 292 241 320C276 381 315 412 359 412Z"/></g><g data-mml-node="mi" transform="translate(550,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(18236.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(18625.5,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(19575.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="P" transform="translate(19964.8,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(20718.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(21107.8,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(22331.9,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="h_j" transform="translate(22887.7,0)"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="mi" transform="translate(609,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(23838,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>这看起来非常像一个更新方程，其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.29ex" height="1ex" role="img" focusable="false" viewBox="0 -431 570 442"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\pi"><g data-mml-node="mi" data-latex="\pi"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.489ex;" xmlns="http://www.w3.org/2000/svg" width="1.17ex" height="1.489ex" role="img" focusable="false" viewBox="0 -442 517 658"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\rho"><g data-mml-node="mi" data-latex="\rho"><path data-c="1D70C" d="M361 442C248 442 154 320 129 220L33-169C31-177 30-182 30-185C30-206 40-216 61-216C76-216 89-208 99-193L160 46C183 7 215-13 256-13C322-13 380 19 431 84C478 145 502 210 502 277C502 368 449 442 361 442M359 412C402 412 423 381 423 319C423 292 417 257 406 212C384 127 353 70 314 40C293 24 274 16 255 16C236 16 219 23 206 36C185 57 175 79 175 100C176 107 178 119 182 136C205 231 225 292 241 320C276 381 315 412 359 412Z"/></g></g></g></svg></mjx-container></span>都是可学习的函数。这便是我们设计双向循环神经网络的理论基础。</p>
<h2><a id="toc-d6f" class="anchor" href="#toc-d6f"></a>机器翻译与数据集</h2><p>本节介绍机器翻译数据集及其相关预处理操作，介绍如何通过截断（truncation）和填充（padding）生成小批次样本（引入一些特殊token表达末尾、占位符、未知词元，将低频词元视为相同的未知词元等）。</p>
<h2><a id="toc-4cc" class="anchor" href="#toc-4cc"></a>编码器-解码器架构</h2><p>本节介绍序列转换模型常用的编码器-解码器架构。</p>
<p>“编码器-解码器”是一个通用的抽象架构，其基本思想是将输入数据编码为一个便于神经网络学习和理解的中间表示，再由解码器将中间表示转换为所需要的输出。这种架构可以根据具体需求适用于不同的实际场景中。</p>
<ul>
<li>编码器：接受一个长度可变的序列作为输入，并将其转换为具有固定形状的编码状态</li>
<li>解码器：将固定形状的编码状态映射到长度可变的序列</li>
</ul>
<p>通过这样的设计，我们就可以方便地处理长度可变的输入和输出序列，实现序列到序列的学习，例如机器翻译问题。</p>
<h2><a id="toc-c03" class="anchor" href="#toc-c03"></a>序列到序列学习（seq2seq）</h2><p>本节正式以机器翻译为例，讲解序列到序列学习。</p>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节的d2l库要修改<code>class EncoderDecoder</code>中<code>return self.decoder(dec_X, dec_state)</code>。</p>
</div>
<div class="markdown-alert markdown-alert-important">
<p class="markdown-alert-title"><svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>本节的<code>predict_seq2seq</code>配合<code>class Seq2SeqDecoder</code>存在错误，本节的decoder是把encoder得到的state与输入拼接起来交给<code>self.rnn</code>计算，这在训练过程中没问题，因为训练是一次性用num_steps个时间步的数据训练的，<code>self.rnn</code>内部做了num_steps个时间步的计算，decoder返回的state也没有被二次使用。而在预测过程中，decoder的输入的num_steps是1，也就是每次只做一个时间步的计算，整个循环是在<code>predict_seq2seq</code>函数中，而非<code>self.rnn</code>内部，这就导致每次执行<code>self.rnn</code>所使用的输入，其实用的是decoder的最近一个时间步的状态，是一直在变的，而非固定使用encoder的最后一个状态。
这个问题只在本节的例子中存在，后续Bahdanau注意力中所实现的<code>class Seq2SeqAttentionDecoder</code>由于固定使用encoder输出的enc_outputs，所以没有问题。</p>
</div>
<p>事实上，普通的RNN也能够解决seq2seq问题，例如我们训练一个<code>&lt;...原文...&gt;&lt;特殊标记&gt;&lt;...译文...&gt;&lt;结束标记&gt;</code>的序列模型，输入原文和特殊标记后，让模型预测直到模型输出一个特定的结束标记即可。</p>
<p>但是单RNN续写的思路效果不好，所以我们引入编码器-解码器架构，把理解和生成拆开，两个模型各司其职：</p>
<ul>
<li>编码器：专门学习“源语言序列”-&gt;“整句语义向量”的映射，只处理源语言</li>
<li>解码器：专门学习“语义向量”-&gt;“目标语言序列”的生成，只处理目标语言</li>
</ul>
<p>二者唯一的交集，就是编码器把最终隐状态交给解码器做初始状态（Sutskever et al., 2014）。而在其他的设计（Cho et al., 2014）中，不仅把编码器最终隐状态交给解码器做初始状态，还把它加到编码器每一个时间步的输入中。以这个设计为例，流程如下：</p>
<pre class="mermaid">flowchart LR
    src[&quot;源&quot;]
    dst[&quot;目标&quot;]
    embedding_src[&quot;嵌入层&quot;]
    embedding_dst[&quot;嵌入层&quot;]
    init_state_src([&quot;初始化RNN状态\n（用0初始化）&quot;])
    init_state_dst([&quot;初始化RNN状态&quot;])
    rnn_src[&quot;RNN&quot;]
    rnn_dst[&quot;RNN&quot;]
    output_src[&quot;$$\mathbf{O}_i$$&quot;]@{ shape: processes}
    state_src[&quot;$$\mathbf{H}_i$$&quot;]@{ shape: processes}
    output_dst[&quot;$$\mathbf{O}_i$$&quot;]@{ shape: processes}
    state_dst[&quot;$$\mathbf{H}_i$$&quot;]@{ shape: processes}
    X_and_context_dst[&quot;$$concat(\mathbf{X}_i,\mathbf{H}_t)$$&quot;]
    dense_dst[&quot;全连接层&quot;]
    Y_hat_dst[&quot;$$\hat{\mathbf{Y}}_i$$&quot;]@{ shape: processes}
    Y_dst[&quot;$$\mathbf{Y}_i$$&quot;]@{ shape: processes}
    loss[&quot;loss(SoftmaxCE)&quot;]
    mask[&quot;mask(loss)&quot;]

    subgraph encoder
    src --&gt; embedding_src e1@-.-&gt;|&quot;$$\mathbf{X}$$&quot;| rnn_src
    init_state_src --&gt; rnn_src e2@--&gt;|num_steps| rnn_src
    rnn_src e3@-.-&gt; output_src
    rnn_src e4@-.-&gt; state_src
    end
    subgraph decoder
    dst --&gt; embedding_dst e5@-.-&gt;|&quot;$$\mathbf{X}$$&quot;| X_and_context_dst
    state_src -.-&gt;|&quot;$$\mathbf{H}_t$$&quot;| X_and_context_dst e6@--&gt; rnn_dst
    init_state_dst --&gt; rnn_dst e7@--&gt;|num_steps| rnn_dst
    state_src -.-&gt;|&quot;$$\mathbf{H}_t$$&quot;| init_state_dst
    rnn_dst e8@-.-&gt; output_dst
    rnn_dst e9@-.-&gt; state_dst
    output_dst --&gt; dense_dst -.-&gt; Y_hat_dst
    end
    Y_hat_dst -.-&gt; loss
    Y_dst -.-&gt; loss
    loss --&gt; mask

    classDef animate stroke-dasharray: 9,5,stroke-dashoffset: 900,animation: dash 25s linear infinite;
    class e1,e2,e3,e4,e5,e6,e7,e8,e9,e10 animate</pre><p>为了让解码器产生第一个输入，我们要对解码器提供一个特殊的输入<code>&lt;bos&gt;</code>，以表达预测序列的开始。</p>
<p>相比普通的RNN，在这一流程中还引入了嵌入层和带掩码的损失函数。</p>
<ul>
<li>嵌入层：把独热向量转化为嵌入向量，可以降低维度、训练词与词之间的语义关联</li>
<li>带掩码的损失函数：训练时让标签文本中用于补齐的<code>&lt;pad&gt;</code>字符不参与损失计算和梯度更新</li>
</ul>
<p>此外，在本节中，我们使用教师强制的方法训练，而不是自回归：</p>
<ul>
<li>教师强制：每个时间步用真实上文生成一个下文计算损失</li>
<li>自回归：每个时间步都用上一个时间步模型生成的结果作为上文生成一个下文计算损失</li>
</ul>
<p>最后，本节介绍了一个用于预测序列的评估的方法BLEU：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="36.337ex" height="6.644ex" role="img" focusable="false" viewBox="0 -1740.7 16060.9 2936.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\exp\left(\min\left(0, 1 - \frac{\mathrm{len}_{\text{label}}}{\mathrm{len}_{\text{pred}}}\right)\right) \prod_{n=1}^k p_n^{1/2^n}"><g data-mml-node="mi" data-latex="\exp"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(1528,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left(\min\left(0, 1 - \frac{\mathrm{len}_{\text{label}}}{\mathrm{len}_{\text{pred}}}\right)\right)" transform="translate(1694.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M660-946C675-946 682-939 682-924C682-917 679-911 674-907C606-856 545-777 490-670C393-480 320-209 320 65L320 435C320 560 335 686 364 813C416 1043 523 1293 674 1407C679 1411 682 1417 682 1424C682 1439 675 1446 660 1446C656 1446 652 1444 647 1441C574 1386 505 1304 440 1195C327 1005 226 718 226 435L226 65C226-202 320-477 422-664C490-787 565-880 647-941C652-944 656-946 660-946Z"/></g><g data-mml-node="mo" data-latex="\min" transform="translate(736,0)"><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(833,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(1111,0)"/></g><g data-mml-node="mrow" data-latex="\left(0, 1 - \frac{\mathrm{len}_{\text{label}}}{\mathrm{len}_{\text{pred}}}\right)" transform="translate(2569.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M660-946C675-946 682-939 682-924C682-917 679-911 674-907C606-856 545-777 490-670C393-480 320-209 320 65L320 435C320 560 335 686 364 813C416 1043 523 1293 674 1407C679 1411 682 1417 682 1424C682 1439 675 1446 660 1446C656 1446 652 1444 647 1441C574 1386 505 1304 440 1195C327 1005 226 718 226 435L226 65C226-202 320-477 422-664C490-787 565-880 647-941C652-944 656-946 660-946Z"/></g><g data-mml-node="mn" data-latex="0" transform="translate(736,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1236,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1680.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(2402.9,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\mathrm{len}_{\text{label}}}{\mathrm{len}_{\text{pred}}}" transform="translate(3403.1,0)"><g data-mml-node="msub" data-latex="\mathrm{len}_{\text{label}}" transform="translate(220,676)"><g data-mml-node="TeXAtom" data-latex="\mathrm{len}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="len"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(278,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(722,0)"/></g></g><g data-mml-node="TeXAtom" transform="translate(1311,-150) scale(0.707)" data-latex="{\text{label}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{label}"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(278,0)"/><path data-c="62" d="M298-11C360-11 413 11 456 56C499 101 521 154 521 217C521 278 501 332 460 377C419 422 369 445 308 445C259 445 215 426 178 387L178 694L28 683L28 645C64 645 86 642 94 636C102 630 105 616 105 593L105 0L136 0L169 58C201 12 244-11 298-11M294 19C253 19 219 38 194 77C185 90 181 104 181 117L181 320C181 333 184 344 191 354C220 395 257 415 304 415C345 415 378 395 404 354C422 324 431 279 431 218C431 110 393 19 294 19Z" transform="translate(778,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(1334,0)"/><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(1778,0)"/></g></g></g><g data-mml-node="msub" data-latex="\mathrm{len}_{\text{pred}}" transform="translate(258.2,-686)"><g data-mml-node="TeXAtom" data-latex="\mathrm{len}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="len"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(278,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(722,0)"/></g></g><g data-mml-node="TeXAtom" transform="translate(1311,-150) scale(0.707)" data-latex="{\text{pred}}" data-mjx-texclass="ORD"><g data-mml-node="mtext" data-latex="\text{pred}"><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z"/><path data-c="72" d="M364 378C364 417 327 442 288 442C237 442 198 412 172 351L172 442L28 431L28 393C63 393 84 390 92 384C100 378 104 365 104 342L104 79C104 60 101 48 94 44C87 40 65 38 28 38L28 0L143 3C185 4 228 3 271 0L271 38L247 38C214 38 193 41 186 46C179 51 176 63 176 81L176 232C176 275 184 314 199 347C219 390 248 412 287 413C277 403 272 391 272 377C272 346 287 331 318 331C345 331 364 352 364 378Z" transform="translate(556,0)"/><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z" transform="translate(948,0)"/><path data-c="64" d="M374-11L527 0L527 38C491 38 470 40 462 46C454 52 450 67 450 90L450 694L301 683L301 645C336 645 358 642 366 636C374 630 377 616 377 593L377 390C345 427 305 445 257 445C195 445 142 423 99 378C56 333 34 279 34 216C34 155 54 102 95 57C136 12 186-11 247-11C298-11 341 8 374 47M261 415C304 415 339 396 364 358C371 347 374 336 374 323L374 121C374 108 371 97 364 86C336 41 298 19 251 19C210 19 177 39 151 80C133 110 124 155 124 215C124 324 161 415 261 415Z" transform="translate(1392,0)"/></g></g></g><rect width="3014.8" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(6657.9,0)"><path data-c="29" d="M89-941C162-886 231-804 296-695C409-506 510-218 510 65L510 435C510 702 416 977 314 1164C246 1287 171 1380 89 1441C84 1444 80 1446 76 1446C61 1446 54 1439 54 1424C54 1417 57 1411 62 1407C130 1356 191 1277 246 1170C343 980 416 709 416 435L416 65C416-60 401-186 372-313C320-543 213-793 62-907C57-911 54-917 54-924C54-939 61-946 76-946C80-946 84-944 89-941Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(9963.6,0)"><path data-c="29" d="M89-941C162-886 231-804 296-695C409-506 510-218 510 65L510 435C510 702 416 977 314 1164C246 1287 171 1380 89 1441C84 1444 80 1446 76 1446C61 1446 54 1439 54 1424C54 1417 57 1411 62 1407C130 1356 191 1277 246 1170C343 980 416 709 416 435L416 65C416-60 401-186 372-313C320-543 213-793 62-907C57-911 54-917 54-924C54-939 61-946 76-946C80-946 84-944 89-941Z"/></g></g><g data-mml-node="munderover" data-latex="\prod_{n=1}^k" transform="translate(12560.9,0)"><g data-mml-node="mo" data-latex="\prod" transform="translate(25,0)"><path data-c="220F" d="M735-450L1221-450L1221-388C1158-388 1115-379 1092-361C1069-343 1058-317 1058-283L1058 783C1058 818 1069 844 1092 862C1115 880 1158 888 1221 888L1221 950L56 950L56 888C119 888 162 879 185 861C208 843 219 817 219 783L219-283C219-318 208-344 185-362C162-380 119-388 56-388L56-450L542-450L542-388C479-388 436-379 413-361C390-343 379-317 379-283L379 888L898 888L898-283C898-318 887-344 864-362C841-380 798-388 735-388Z"/></g><g data-mml-node="TeXAtom" transform="translate(0,-1087.9) scale(0.707)" data-latex="{n=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(600,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1378,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(479.8,1150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="msubsup" data-latex="p_n^{1/2^n}" transform="translate(14055.5,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,530.4) scale(0.707)" data-latex="{1/2^n}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(500,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="msup" data-latex="2^n" transform="translate(1000,0)"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" transform="translate(533,363) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g><g data-mml-node="mi" transform="translate(536,-138.9) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>它主要包含两项：对于较短的预测序列的惩罚项、预测序列与标签序列<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>元语法的匹配度。</p>
<ul>
<li>惩罚项：如果预测序列相比标签序列短很多，惩罚因子就会比较小，会降低会降低BLEU值。</li>
<li>匹配度：如果我们要评估<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.179ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 521 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></svg></mjx-container></span>元语法的匹配度，其值为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="4.958ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 2191.3 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1 \dots k"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" transform="translate(666.7,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mi" data-latex="k" transform="translate(1670.3,0)"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></svg></mjx-container></span>的匹配度的乘积，其中匹配度<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.439ex;" xmlns="http://www.w3.org/2000/svg" width="2.286ex" height="1.439ex" role="img" focusable="false" viewBox="0 -442 1010.3 636"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_n"><g data-mml-node="msub" data-latex="p_n"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g></svg></mjx-container></span>定义为：预测序列的所有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>元语法中，其与标签序列中匹配的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>元语法所占的比例。另外我们还通过指数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.541ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2007.3 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="1/2^n"><g data-mml-node="mn" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(500,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="msup" data-latex="2^n" transform="translate(1000,0)"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" transform="translate(533,363) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></g></svg></mjx-container></span>对更大的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>赋予更高的权重。</li>
</ul>
<h2><a id="toc-093" class="anchor" href="#toc-093"></a>束搜索</h2><p>本节主要讲解如何在预测过程中选择候选的问题。序列预测问题特殊的一个地方在于，其产出的是一个序列而非一个值，我们需要在每个时间步选择一个值，实现最大化整个序列的联合概率。</p>
<p>之前我们的预测过程都是在每个时间步直接选择概率最大的值，这是典型的贪心做法，不能保证最终选出来的序列是所有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="8.017ex" height="2.847ex" role="img" focusable="false" viewBox="0 -1008.2 3543.6 1258.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(\left|\mathcal{Y}\right|^{T'})"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msup" data-latex="\left|\mathcal{Y}\right|^{}" transform="translate(1088,0)"><g data-mml-node="mrow" data-latex="\left|\mathcal{Y}\right|"><g data-mml-node="mo" data-latex="\left|"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{Y}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="Y"><path data-c="59" d="M472 252L588 688L575 703L509 669L455 462C448 443 428 419 394 392C339 347 293 325 257 325C240 325 225 332 212 347C207 353 205 363 205 377C205 398 208 420 215 443L263 611C272 644 272 667 263 679C256 688 246 693 233 693C210 693 182 679 148 652C131 638 109 615 82 584L106 571C143 600 166 615 176 615C180 615 183 613 186 610C189 608 175 558 172 549L135 410C130 389 127 371 127 356C127 335 131 319 140 307C153 292 193 275 220 275C273 276 344 312 435 383L411 288C304 231 231 186 192 154C160 128 127 94 92 51C68 21 52-9 45-40C29-104 53-136 116-136C171-136 225-114 280-70C369 2 433 109 472 252M398 238C383 176 359 115 328 56C277-42 220-91 159-91C137-91 121-84 111-70C104-61 104-43 111-17C117 8 130 34 151 61C204 132 311 204 398 238Z"/></g></g><g data-mml-node="mo" data-latex="\right|" transform="translate(906,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1217,477.1) scale(0.707)" data-latex="{}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g><g data-mml-node="mo" transform="translate(793,363) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3154.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>个可能的序列中联合概率最大的那一个。</p>
<p>与之相对应的，穷举搜索是将所有可能的序列都计算联合概率，找到一个联合概率最大的序列，这种方法的计算量巨大。因此贪心搜索与穷举搜索是两个极端。</p>
<p>本节引入<strong>束搜索</strong>，其关键思想是：每个时间步并非直接找概率最大的token，而是找到<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.179ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 521 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></svg></mjx-container></span>个候选，针对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.179ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 521 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></svg></mjx-container></span>个候选计算下一个时间步所有<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.235ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1871.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k\left|\mathcal{Y}\right|"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mrow" data-latex="\left|\mathcal{Y}\right|" transform="translate(687.7,0)"><g data-mml-node="mo" data-latex="\left|"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathcal{Y}" data-mjx-texclass="ORD" transform="translate(278,0)"><g data-mml-node="mi" data-latex="Y"><path data-c="59" d="M472 252L588 688L575 703L509 669L455 462C448 443 428 419 394 392C339 347 293 325 257 325C240 325 225 332 212 347C207 353 205 363 205 377C205 398 208 420 215 443L263 611C272 644 272 667 263 679C256 688 246 693 233 693C210 693 182 679 148 652C131 638 109 615 82 584L106 571C143 600 166 615 176 615C180 615 183 613 186 610C189 608 175 558 172 549L135 410C130 389 127 371 127 356C127 335 131 319 140 307C153 292 193 275 220 275C273 276 344 312 435 383L411 288C304 231 231 186 192 154C160 128 127 94 92 51C68 21 52-9 45-40C29-104 53-136 116-136C171-136 225-114 280-70C369 2 433 109 472 252M398 238C383 176 359 115 328 56C277-42 220-91 159-91C137-91 121-84 111-70C104-61 104-43 111-17C117 8 130 34 151 61C204 132 311 204 398 238Z"/></g></g><g data-mml-node="mo" data-latex="\right|" transform="translate(906,0)"><path data-c="7C" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g></g></g></g></svg></mjx-container></span>个候选，选择其中概率最大的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.179ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 521 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="k"><g data-mml-node="mi" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></svg></mjx-container></span>个作为新的候选继续计算。在整个搜索过程中把生成了<code>&lt;eos&gt;</code>的序列都拿出来作为最终候选输出序列集合，选择其中条件概率乘积最高的序列作为输出序列：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.723ex;" xmlns="http://www.w3.org/2000/svg" width="57.216ex" height="6.645ex" role="img" focusable="false" viewBox="0 -1733.7 25289.3 2937.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\frac{1}{L^\alpha} \log P(y_1, \ldots, y_{L}\mid \mathbf{c}) = \frac{1}{L^\alpha} \sum_{t'=1}^L \log P(y_{t'} \mid y_1, \ldots, y_{t'-1}, \mathbf{c})"><g data-mml-node="mfrac" data-latex="\frac{1}{L^\alpha}"><g data-mml-node="mn" data-latex="1" transform="translate(578.3,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="msup" data-latex="L^\alpha" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mi" transform="translate(714,289) scale(0.707)" data-latex="\alpha"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g></g><rect width="1416.5" height="60" x="120" y="220"/></g><g data-mml-node="mi" data-latex="\log" transform="translate(1656.5,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(2934.5,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="P" transform="translate(3101.2,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3855.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_1" transform="translate(4244.2,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mn" transform="translate(523,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5170.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(5615.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(6619.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="y_{L}" transform="translate(7063.8,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{L}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(8396.1,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{c}" data-mjx-texclass="ORD" transform="translate(8951.9,0)"><g data-mml-node="mi" data-latex="c"><path data-c="1D41C" d="M478 117C478 131 464 131 454 131C436 131 435 129 430 116C404 53 356 34 305 34C166 34 166 181 166 227C166 283 166 413 295 413C330 413 347 410 360 407C342 391 340 370 340 361C340 317 375 298 402 298C433 298 465 319 465 361C465 447 349 453 291 453C112 453 38 338 38 222C38 89 132-6 286-6C448-6 478 110 478 117Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(9462.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(10129.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{L^\alpha}" transform="translate(11185.4,0)"><g data-mml-node="mn" data-latex="1" transform="translate(578.3,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="msup" data-latex="L^\alpha" transform="translate(220,-686)"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mi" transform="translate(714,289) scale(0.707)" data-latex="\alpha"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g></g><rect width="1416.5" height="60" x="120" y="220"/></g><g data-mml-node="munderover" data-latex="\sum_{=1}^L" transform="translate(13008.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(11.4,-1095.9) scale(0.707)" data-latex="{=1}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(731.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1509.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(481.2,1150) scale(0.707)" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g><g data-mml-node="mi" data-latex="\log" transform="translate(14619.3,0)"><path data-c="6C" d="M144 3L255 0L255 39C219 39 197 40 190 44C183 48 180 60 180 79L180 694L33 683L33 645C68 645 90 642 97 636C104 630 108 616 108 593L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(278,0)"/><path data-c="67" d="M431 453C393 453 358 438 326 408C296 431 262 442 223 442C137 442 59 378 59 294C59 252 74 218 104 192C85 168 75 141 75 110C75 72 88 43 113 24C71 10 28-26 28-77C28-120 56-154 111-178C153-197 199-206 249-206C300-206 347-197 389-178C444-154 471-120 471-75C471-22 449 17 405 42C359 67 308 70 234 70C190 70 166 70 161 71C133 75 113 102 113 133C113 148 117 162 126 174C154 155 186 145 223 145C309 145 386 209 386 293C386 332 373 364 347 389C372 412 399 423 428 423C423 418 420 410 420 400C420 378 431 367 453 367C474 367 485 378 485 401C485 432 461 453 431 453M223 411C277 411 304 372 304 294C304 215 277 175 223 175C168 175 141 214 141 293C141 372 168 411 223 411M164 4L222 4C274 4 316 1 348-6C391-15 412-39 412-77C412-109 392-134 352-153C321-168 287-175 250-175C214-175 180-168 148-153C107-134 87-109 87-77C87-35 123 4 164 4Z" transform="translate(778,0)"/></g><g data-mml-node="mo" transform="translate(15897.3,0)"><path data-c="2061" d=""/></g><g data-mml-node="mi" data-latex="P" transform="translate(16064,0)"><path data-c="1D443" d="M555 683L235 683C212 683 201 682 201 660C201 649 212 644 234 644C254 644 294 647 294 631C294 629 293 623 290 613L158 82C152 60 142 47 128 42C121 40 103 39 72 39C50 39 40 37 40 16C40 5 46 0 59 0L184 3L248 2C259 2 299 0 312 0C328 0 336 8 336 24C336 34 325 39 304 39C264 39 244 43 244 52C244 52 245 55 247 68L307 312L472 312C537 312 599 332 657 371C722 414 754 467 754 530C754 629 660 683 555 683M524 644C611 644 654 614 654 554C654 498 626 423 597 397C559 363 509 346 447 346L313 346L379 610C387 644 387 644 429 644Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(16818,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="y_{}" transform="translate(17207,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g></g></g><g data-mml-node="mo" data-latex="\mid" transform="translate(18575.2,0)"><path data-c="2223" d="M139-250C152-250 159-242 159-226L159 726C159 742 152 750 139 750C126 750 119 742 119 726L119-226C119-242 126-250 139-250Z"/></g><g data-mml-node="msub" data-latex="y_1" transform="translate(19131,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mn" transform="translate(523,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(20057.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(20502.2,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(21505.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="y_{-1}" transform="translate(21950.5,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="TeXAtom" transform="translate(523,-150) scale(0.707)" data-latex="{-1}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(731.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1509.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(23944.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{c}" data-mjx-texclass="ORD" transform="translate(24389.3,0)"><g data-mml-node="mi" data-latex="c"><path data-c="1D41C" d="M478 117C478 131 464 131 454 131C436 131 435 129 430 116C404 53 356 34 305 34C166 34 166 181 166 227C166 283 166 413 295 413C330 413 347 410 360 407C342 391 340 370 340 361C340 317 375 298 402 298C433 298 465 319 465 361C465 447 349 453 291 453C112 453 38 338 38 222C38 89 132-6 286-6C448-6 478 110 478 117Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(24900.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></p>
<p>其中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.541ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 681 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g></g></g></svg></mjx-container></span>是最终候选序列的长度，分母中的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="2.752ex" height="1.548ex" role="img" focusable="false" viewBox="0 -684 1216.5 684"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="L^\alpha"><g data-mml-node="msup" data-latex="L^\alpha"><g data-mml-node="mi" data-latex="L"><path data-c="1D43F" d="M520 667C520 678 513 683 500 683L354 680L223 683C208 684 200 676 200 659C200 652 203 647 209 646C218 645 226 644 231 644C262 643 279 641 284 640C289 639 292 636 292 631C292 629 291 623 288 613L156 82C150 60 140 47 125 42C119 40 101 39 70 39C49 39 39 31 39 15C39 5 49 0 70 0L527 0C552 0 554 0 561 19L639 233C642 240 643 245 643 248C643 258 638 263 627 263C617 263 612 254 607 240C588 191 570 154 555 131C518 75 455 39 363 39L270 39C259 39 252 39 249 40C242 40 239 42 239 45C239 47 241 54 244 67L377 601C383 624 396 637 415 642C421 643 442 644 478 644C506 644 520 644 520 667Z"/></g><g data-mml-node="mi" transform="translate(714,363) scale(0.707)" data-latex="\alpha"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g></g></g></g></svg></mjx-container></span>用于惩罚短序列（因为长序列的项数更多，条件概率乘积天然小于短序列）。</p>
<h1><a id="toc-7b4" class="anchor" href="#toc-7b4"></a>注意力机制</h1><p>终于！本章正式开始介绍注意力机制！本章中文版与英文版差异较大，因此以英文版为主。</p>
<p><strong>在注意力机制诞生前</strong>，虽然大量创新方法（ReLU激活、残差层、批量归一化、Dropout、自适应学习率策略等）被广泛投入实际使用，<strong>但主流基础架构本质上只是经典思路的大规模工程化扩展</strong>。</p>
<p><strong>Transformer诞生后，主流模型架构的格局终于迎来颠覆性变革，几乎所有自然语言处理任务的标杆模型都基于Transformer搭建</strong>。行业标准流程为：先选用大规模预训练Transformer模型，按需修改输出层，再基于下游任务自有数据微调。<strong>Transformer模型的核心思想是注意力机制。</strong></p>
<p><strong>注意力机制</strong>，最初作为编码器-解码器架构的增强模块诞生。编码器-解码器架构中，编码器会将整个输入压缩成一个固定长度的向量，然后输入到解码器。<strong>注意力机制背后的直觉是：与其压缩输入，不如让解码器在每个步骤中重新访问输入序列；解码器不应该总是看到输入的相同表示，而应该在特定的解码步骤中选择性地关注输入序列的特定部分</strong>。Bahdanau的注意力机制提供了一种简单的方法，使解码器能够在每个解码步骤中动态地关注输入的不同部分。其核心思想是：编码器可以生成长度与原始输入序列相同的表示；在解码时，解码器（通过某种控制机制）接收一个上下文向量作为输入，该上下文向量由每个时间步输入表示的加权和构成。直观地说，权重决定了每个时间步的上下文对每个输入词元的“关注”程度。</p>
<p>注意力机制很快成为重要的关注点，其价值不再局限于增强编码器-解码器结构以提取显著输入。<strong>Vaswani等人（2017）提出了用于机器翻译的Transformer架构，完全摒弃了循环连接，转而依靠精心设计的注意力机制来捕捉输入和输出词元之间的所有依赖关系</strong>。该架构表现极其亮眼，到2018年，绝大多数NLP领域SOTA系统都开始采用Transformer。</p>
<p>同一时期，<strong>NLP行业形成新范式</strong>：先用海量通用无标注语料对超大模型做自监督预训练，再基于下游任务数据微调。在这套预训练体系下，Transformer相比传统架构的性能优势被进一步放大。Transformer崛起的过程，恰好也是大规模预训练模型（如今常被称作基座模型，Bommasani等人，2021）蓬勃发展的阶段。</p>
<p>本章将由浅入深讲解注意力模型：从最基本的直觉和最简单的实现入手，逐步延伸至Transformer架构、视觉Transformer，以及当下各类基于Transformer的预训练模型生态。</p>
<h2><a id="toc-60f" class="anchor" href="#toc-60f"></a>注意力提示（Queries, Keys, and Values）</h2><p>本节介绍注意力的基本概念。</p>
<p>CNN和RNN中的输入长度都是固定的，针对变长输入，现有方案要么采用特殊设计的卷积核，要么逐token串行处理。当输入长度差异极大、承载的信息含量也参差不齐时，这类方案会暴露出严重缺陷。尤其是处理超长序列时，网络很难完整记住所有已生成、已读取的内容。</p>
<p>人类的注意力是有限的、有价值和稀缺的资源，对于模型来说也是类似的。一个朴素的想法是：通过引入注意力机制，可以更好地处理信息以优化神经网络的效果。我们将输入信息类比为数据库中的数据，其实我们无需压缩、简化数据库，只需要根据需求在庞大的状态空间（数据库）上执行检索即可。相比记住，检索是相当简单的事情。</p>
<blockquote>
<p>注意力分两种：非自主性注意力和自主性注意力。之前我们在使用的普通的汇聚层、全连接层是固定变换，输入确定则输出确定，属于非自主性注意力。本章我们说的是自主性注意力，它是动态的，查询目标不同，输出的加权结果就不同，信息筛选的结果会随任务目标动态变化。注意力机制与全连接层或者汇聚层的区别源于增加的自主提示。</p>
</blockquote>
<p>注意力=拿目标(Query)，去匹配外界特征(Key)，抽取对应信息(Value)。注意力机制通过注意力汇聚将Query（自主性提示）和Key（非自主性提示）结合在一起，实现对Value（感官输入）的选择倾向。</p>
<p>因此，注意力是个权重矩阵，其形状是<code>(Query的数量，Key的数量)</code>，表达了每个Query对每个Key的权重。</p>
<h2><a id="toc-272" class="anchor" href="#toc-272"></a>注意力汇聚：Nadaraya-Watson核回归（Attention Pooling by Similarity）</h2><p>本节将介绍注意力汇聚的更多细节，以便从宏观上了解注意力机制在实践中的运作方式。</p>
<p>首先引入<strong>Nadaraya-Watson核回归</strong>的概念，它是现代注意力机制最早的雏形之一。<strong>核回归是一种非参数模型，它直接用样本数据做加权平均得到预测结果，其本质上就是一种谁离得近就更像谁的局部加权平滑技术</strong>。用上文介绍的注意力的语言来描述，核回归就是通过计算查询（Query）与键（Key）之间的距离或相似度来分配权重，进而对值（Value）进行加权平均。用来计算相似度的函数就叫做核函数。</p>
<p>我们将其与线性回归对比如下：</p>
<table>
<thead>
<tr>
<th>对比维度</th>
<th>线性回归</th>
<th>核回归</th>
</tr>
</thead>
<tbody><tr>
<td>核心原理</td>
<td>求解固定的权重参数和偏置，通过全局损失最小化（如 MSE）一次性确定参数</td>
<td>利用核函数计算样本间相似度，进行局部加权预测，通过核技巧隐式实现高维映射</td>
</tr>
<tr>
<td>模型形式</td>
<td><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 490 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y=\mathbf{w}^\top \mathbf{x}+b"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.074ex" height="2.449ex" role="img" focusable="false" viewBox="0 -832.5 3126.9 1082.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y=\mathbf{w}^\top \mathbf{x}+b"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="\mathbf{w}^\top" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mi" transform="translate(864,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(2519.9,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.234ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1429.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y=\mathbf{w}^\top \mathbf{x}+b"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1000.2,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span>，有显式权重参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.437ex;" xmlns="http://www.w3.org/2000/svg" width="3.857ex" height="2.007ex" role="img" focusable="false" viewBox="0 -694 1704.7 887"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{w},b"><g data-mml-node="TeXAtom" data-latex="\mathbf{w}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(831,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="b" transform="translate(1275.7,0)"><path data-c="1D44F" d="M281 445C245 445 209 428 174 394L243 679C241 688 238 694 226 694C193 694 120 685 107 684C92 682 84 675 84 660C84 650 93 645 112 645C131 645 157 646 157 632C157 628 152 608 143 571L63 249C52 207 47 173 47 148C47 62 93-11 175-11C240-11 297 22 347 89C392 151 415 216 415 283C415 370 364 445 281 445M279 415C318 415 337 385 337 326C337 299 331 263 319 218C297 133 268 75 233 44C213 27 194 19 175 19C134 19 114 51 114 115C114 137 119 170 129 214L151 304C154 319 159 330 165 338C204 389 242 415 279 415Z"/></g></g></g></svg></mjx-container></span></td>
<td><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.163ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 1840 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y(x)=\sum_{i=1}^n \frac{K(x - x_i)}{\sum_{j=1}^n K(x - x_j)} y_i"><g data-mml-node="TeXAtom" data-latex="\hat y" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(490,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(879,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1451,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.59ex;" xmlns="http://www.w3.org/2000/svg" width="21.124ex" height="3.952ex" role="img" focusable="false" viewBox="0 -1044.3 9336.8 1746.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y(x)=\sum_{i=1}^n \frac{K(x - x_i)}{\sum_{j=1}^n K(x - x_j)} y_i"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^n" transform="translate(1055.8,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,477.1) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(1089,-285.4) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mfrac" data-latex="\frac{K(x - x_i)}{\sum_{j=1}^n K(x - x_j)}" transform="translate(3509.1,0)"><g data-mml-node="mrow" transform="translate(1120.9,515.4) scale(0.707)" data-latex="K(x - x_i)"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(889,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(1278,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(1850,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_i" transform="translate(2628,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3527,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" transform="translate(220,-398.3) scale(0.707)" data-latex="\sum_{j=1}^n K(x - x_j)"><g data-mml-node="munderover" data-latex="\sum_{j=1}^n"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,477.1) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(1089,-285.4) scale(0.707)" data-latex="{j=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="K" transform="translate(2500.7,0)"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(3389.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(3778.7,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(4350.7,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_j" transform="translate(5128.7,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6075,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="4770.7" height="60" x="120" y="220"/></g><g data-mml-node="msub" data-latex="y_i" transform="translate(8519.8,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>，无显式参数</td>
</tr>
<tr>
<td>核心假设</td>
<td>假设输入和输出呈线性关系，依赖该全局假设构建模型</td>
<td>不预设全局函数形式，仅假设数据局部光滑，无线性假设</td>
</tr>
<tr>
<td>模型类型</td>
<td>参数模型，预设直线或超平面关系，参数数量固定，不随训练样本增加而增加</td>
<td>非参数模型，无预设全局函数形式，模型复杂度随训练数据规模增长，预测时依赖全部或部分训练样本</td>
</tr>
<tr>
<td>拟合能力</td>
<td>只能拟合直线或平面，处理非线性数据时需人工手动对特征做多项式扩展，易出现欠拟合</td>
<td>可直接拟合复杂非线性关系，无需显式计算高维坐标，能灵活捕捉数据局部变化</td>
</tr>
</tbody></table>
<blockquote>
<p>核方法的核心哲学：低维的非线性纠缠，往往只是高维线性可分结构的一个投影。核函数可以将输入数据投影到高维空间，从而使得我们可以用简单的线性算法，去捕捉复杂的非线性关系。</p>
</blockquote>
<p>非参数的Nadaraya-Watson核回归具有一致性的优点：如果有足够的数据，此模型会收敛到最优结果。</p>
<p>Nadaraya-Watson核回归是一个最简单的具有注意力机制的模型，它选择一个固定的核函数（例如高斯核），直接确定了数据的权重如何分配。如果我们在其基础上引入参数，那它就是一个可被训练的模型。</p>
<p>教材以一个正弦函数预测的例子进行了讲解。假设我们使用高斯核<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.066ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2239 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="K(u) = \frac{1}{\sqrt{2\pi}} \exp(-\frac{u^2}{2})"><g data-mml-node="mi" data-latex="K"><path data-c="1D43E" d="M804 680C783 680 715 683 694 683C679 683 671 675 671 659C671 651 678 646 692 643C706 640 714 635 714 628C714 617 703 602 680 585L302 296L379 602C384 623 393 636 406 641C412 643 429 644 458 644C484 644 496 644 496 668C496 678 490 683 478 683L351 680L223 683C207 684 199 676 199 660C199 649 210 644 232 644C252 644 293 647 293 631C293 629 292 623 289 613L156 82C151 60 141 47 126 42C119 40 101 39 70 39C48 39 38 37 38 16C38 5 44 0 57 0L183 3L246 2C257 2 299 0 310 0C326 0 334 8 334 24C334 34 324 39 303 39C262 39 242 43 242 52C242 57 245 72 251 95L290 249L433 359L546 98C553 81 557 70 557 65C557 48 541 39 510 39C492 39 484 35 484 15C484 5 490 0 502 0C524 0 600 3 622 3C641 3 701 0 720 0C734 0 741 8 741 24C741 33 733 38 718 39C677 39 667 50 653 81L512 404C511 409 509 413 508 416L708 570C757 608 799 631 833 639C857 643 889 642 889 668C889 678 884 683 874 683C860 683 818 680 804 680Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(889,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="u" transform="translate(1278,0)"><path data-c="1D462" d="M543 144C543 153 538 158 527 158C518 158 513 151 510 137C505 118 500 99 493 80C480 39 462 18 440 18C422 18 413 32 413 60C413 77 420 111 433 161L460 267C469 303 477 328 483 359L489 386C491 393 492 398 492 401C492 421 481 431 459 431C437 431 423 419 417 394L343 98C342 95 338 88 330 76C314 50 275 18 235 18C197 18 178 44 178 95C178 136 196 202 231 294C242 324 248 345 248 357C248 407 213 442 163 442C118 442 83 417 58 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C174 413 181 403 181 384C181 369 175 348 164 319C126 218 107 148 107 111C107 34 155-11 232-11C275-11 314 9 347 50C361 9 391-11 437-11C506-11 527 70 543 144Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1850,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -1.334ex;" xmlns="http://www.w3.org/2000/svg" width="10.798ex" height="3.291ex" role="img" focusable="false" viewBox="0 -864.9 4772.5 1454.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="K(u) = \frac{1}{\sqrt{2\pi}} \exp(-\frac{u^2}{2})"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{\sqrt{2\pi}}" transform="translate(1055.8,0)"><g data-mml-node="mn" transform="translate(723.1,394) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="msqrt" transform="translate(220,-515.3) scale(0.707)" data-latex="\sqrt{2\pi}"><g data-mml-node="mo" transform="translate(0,837.4)"><path data-c="221A" d="M847-2C851 7 853 13 853 16C853 32 845 40 829 40C820 40 813 36 809 27C666-259 595-403 595-405L595-406C595-413 527-558 390-843L217-461C212-450 207-445 201-445C198-445 192-448 184-454L86-528C77-535 73-540 73-545C73-555 78-560 87-560C90-560 95-557 103-551L151-516L345-943C350-954 357-960 367-960C379-960 387-955 392-946Z"/></g><g transform="translate(853,0)"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="\pi" transform="translate(500,0)"><path data-c="1D70B" d="M524 431L194 431C153 431 117 415 88 384C74 369 27 305 27 292C31 285 31 279 43 279C50 279 56 283 62 292C94 341 135 366 184 366L235 366C212 279 170 172 110 45C105 33 102 24 102 19C102-1 113-11 134-11C153-11 167 0 176 21C194 78 207 122 214 152L269 366L372 366C345 247 331 164 331 117C331 68 342-11 379-11C400-11 423 9 423 30C423 35 421 43 417 53C398 100 389 153 389 214C389 261 395 312 406 366L515 366C550 366 567 378 567 403C567 426 549 431 524 431Z"/></g></g><rect width="1070" height="42.4" x="853" y="835"/></g><rect width="1559.8" height="60" x="120" y="220"/></g><g data-mml-node="mi" data-latex="\exp" transform="translate(2855.5,0)"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(4383.5,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(4383.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g></g></g></svg><mjx-break size="0"> </mjx-break><svg style="vertical-align: -0.781ex;" xmlns="http://www.w3.org/2000/svg" width="5.249ex" height="3.006ex" role="img" focusable="false" viewBox="0 -983.7 2320.2 1328.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="K(u) = \frac{1}{\sqrt{2\pi}} \exp(-\frac{u^2}{2})"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mfrac" data-latex="\frac{u^2}{2}" transform="translate(778,0)"><g data-mml-node="msup" transform="translate(220,394) scale(0.707)" data-latex="u^2"><g data-mml-node="mi" data-latex="u"><path data-c="1D462" d="M543 144C543 153 538 158 527 158C518 158 513 151 510 137C505 118 500 99 493 80C480 39 462 18 440 18C422 18 413 32 413 60C413 77 420 111 433 161L460 267C469 303 477 328 483 359L489 386C491 393 492 398 492 401C492 421 481 431 459 431C437 431 423 419 417 394L343 98C342 95 338 88 330 76C314 50 275 18 235 18C197 18 178 44 178 95C178 136 196 202 231 294C242 324 248 345 248 357C248 407 213 442 163 442C118 442 83 417 58 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C174 413 181 403 181 384C181 369 175 348 164 319C126 218 107 148 107 111C107 34 155-11 232-11C275-11 314 9 347 50C361 9 391-11 437-11C506-11 527 70 543 144Z"/></g><g data-mml-node="mn" transform="translate(605,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mn" transform="translate(399.8,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="913.2" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1931.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，对应的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.163ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 1840 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y(x) = \sum_{i=1}^n \mathrm{softmax}\left(-\frac{1}{2}(x - x_i)^2\right) y_i"><g data-mml-node="TeXAtom" data-latex="\hat y" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(490,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(879,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1451,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.785ex;" xmlns="http://www.w3.org/2000/svg" width="32.816ex" height="2.742ex" role="img" focusable="false" viewBox="0 -864.9 14504.9 1211.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y(x) = \sum_{i=1}^n \mathrm{softmax}\left(-\frac{1}{2}(x - x_i)^2\right) y_i"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^n" transform="translate(1055.8,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,477.1) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="TeXAtom" transform="translate(1089,-285.4) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="TeXAtom" data-latex="\mathrm{softmax}" data-mjx-texclass="ORD" transform="translate(3509.1,0)"><g data-mml-node="mi" data-latex="softmax"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g></g><g data-mml-node="mrow" data-latex="\left(-\frac{1}{2}(x - x_i)^2 \right)" transform="translate(7125.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M380-347C390-347 395-342 395-332C395-327 393-323 390-320C329-273 280-196 243-88C211 5 195 97 195 186L195 314C195 403 211 495 243 588C280 696 329 773 390 820C393 823 395 827 395 832C395 842 390 847 380 847C378 847 375 846 372 844C302 791 244 711 198 604C153 503 131 406 131 314L131 186C131 94 153-3 198-104C244-211 302-291 372-344C375-346 378-347 380-347Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(458,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{2}" transform="translate(1236,0)"><g data-mml-node="mn" transform="translate(220,394) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mn" transform="translate(220,-345) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="553.6" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2029.6,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(2418.6,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(3212.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_i" transform="translate(4213,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="msup" data-latex=")^2" transform="translate(5111.9,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mn" transform="translate(422,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(5937.5,0)"><path data-c="29" d="M86-344C156-291 214-211 260-104C305-3 327 94 327 186L327 314C327 406 305 503 260 604C214 711 156 791 86 844C83 846 80 847 78 847C68 847 63 842 63 832C63 827 65 823 68 820C129 773 178 696 215 588C247 495 263 403 263 314L263 186C263 97 247 5 215-88C178-196 129-273 68-320C65-323 63-327 63-332C63-342 68-347 78-347C80-347 83-346 86-344Z"/></g></g><g data-mml-node="msub" data-latex="y_i" transform="translate(13687.9,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>，加上一个可学习的权重：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="40.34ex" height="6.24ex" role="img" focusable="false" viewBox="0 -1562.5 17830.5 2758.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y(x) = \sum_{i=1}^n \mathrm{softmax}\left(-\frac{1}{2}((x - x_i)w)^2\right) y_i"><g data-mml-node="TeXAtom" data-latex="\hat y" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(490,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(879,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1451,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(2117.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^n" transform="translate(3173.6,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(148.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(509.9,1150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathrm{softmax}" data-mjx-texclass="ORD" transform="translate(4784.2,0)"><g data-mml-node="mi" data-latex="softmax"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g></g><g data-mml-node="mrow" data-latex="\left(-\frac{1}{2}((x - x_i)w)^2 \right)" transform="translate(8400.9,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M588-796C601-796 608-789 608-776C608-770 606-765 601-760C500-684 420-552 361-365C310-206 285-51 285 101L285 399C285 551 310 706 361 865C420 1052 500 1184 601 1260C606 1265 608 1270 608 1276C608 1289 601 1296 588 1296C583 1296 579 1295 576 1292C464 1207 372 1071 300 886C234 717 201 554 201 399L201 101C201-54 234-217 300-386C372-571 464-707 576-792C579-795 583-796 588-796Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(663,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{2}" transform="translate(1441,0)"><g data-mml-node="mn" data-latex="1" transform="translate(220,676)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(220,-686)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><rect width="700" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2381,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2770,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="x" transform="translate(3159,0)"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mo" data-latex="-" transform="translate(3953.2,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="msub" data-latex="x_i" transform="translate(4953.4,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g><g data-mml-node="mi" transform="translate(605,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5852.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="w" transform="translate(6241.4,0)"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g><g data-mml-node="msup" data-latex=")^2" transform="translate(6957.4,0)"><g data-mml-node="mo" data-latex=")"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mn" transform="translate(422,413) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(7782.9,0)"><path data-c="29" d="M86-792C198-707 290-571 363-386C429-217 462-54 462 101L462 399C462 554 429 717 363 886C290 1071 198 1207 86 1292C83 1295 80 1296 75 1296C62 1296 55 1289 55 1276C55 1269 57 1264 62 1260C163 1183 243 1052 302 865C353 707 378 552 378 399L378 101C378-51 353-206 302-365C243-552 163-684 62-760C57-764 55-769 55-776C55-789 62-796 75-796C80-796 83-795 86-792Z"/></g></g><g data-mml-node="msub" data-latex="y_i" transform="translate(17013.5,0)"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>我们的任务就是训练<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.62ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 716 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="w"><g data-mml-node="mi" data-latex="w"><path data-c="1D464" d="M590 391C590 382 595 372 606 362C629 340 641 313 641 281C641 264 635 237 623 198C586 78 539 18 482 18C435 18 412 45 412 100C412 119 416 142 423 171C441 243 460 314 477 387C479 394 480 398 480 401C480 421 469 431 447 431C427 431 414 421 407 401L367 245C352 187 341 167 341 115C341 107 341 101 342 98C319 45 290 18 255 18C205 18 180 47 180 104C180 141 197 204 231 293C242 323 248 344 248 357C248 406 212 442 163 442C118 442 84 417 59 367C39 328 29 301 29 287C29 278 34 273 45 273C58 273 60 279 64 293C88 373 120 413 160 413C174 413 181 403 181 384C181 369 175 347 164 317C127 220 108 154 108 117C108 32 165-11 252-11C294-11 328 10 355 53C375 10 416-11 479-11C541-11 590 30 625 112C648 164 691 302 691 369C691 384 690 394 689 399C685 418 666 442 644 442C618 442 590 417 590 391Z"/></g></g></g></svg></mjx-container></span>。教材随机生成了50对用于训练的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>（同时也作为数据库）和50对用于预测的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>，因此批次大小为50，数据维度都是1，对应的Q/K/V形状如下：</p>
<ul>
<li>Q：<code>(50,)</code>，内容为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>（根据是预测还是训练选择对应的值），在forward中被repeat_interleave为<code>(50,49)</code>，便于与K进行softmax计算</li>
<li>K：<code>(50,49)</code>，代表了对于批次中每个输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>，数据库的候选KV对中的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>值（训练时针对每个输入在数据库候选中剔除了它自己，所以只有49）</li>
<li>注意力权重：<code>(50,49)</code>，代表了对于每个输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>，数据库中的每个候选的权重大小</li>
<li>V：<code>(50,49)</code>，代表了对于批次中每个输入<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.294ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 572 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="x"><g data-mml-node="mi" data-latex="x"><path data-c="1D465" d="M527 373C527 419 482 442 432 442C389 442 355 419 329 373C308 419 273 442 222 442C173 442 133 419 101 374C74 335 60 306 60 287C60 278 65 273 75 273C84 273 90 278 92 287C111 345 153 413 220 413C253 413 269 392 269 351C269 330 251 252 216 118C199 51 169 18 126 18C112 18 99 21 88 26C114 36 127 54 127 80C127 106 114 119 87 119C54 119 29 91 29 58C29 12 76-11 125-11C167-11 201 12 228 58C247 12 283-11 335-11C383-11 423 12 455 57C482 96 496 125 496 144C496 153 491 158 481 158C472 158 467 153 464 144C447 87 402 18 337 18C304 18 287 38 287 79C287 92 292 120 303 165L337 300C356 375 387 413 431 413C445 413 458 410 469 405C442 396 429 378 429 351C429 325 443 312 470 312C502 312 527 341 527 373Z"/></g></g></g></svg></mjx-container></span>，数据库的候选KV对中的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 490 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg></mjx-container></span>值</li>
</ul>
<p>因此，注意力权重是Q与K经过核函数计算出来的，将注意力权重与V在第二维求点积，就可以得到加权后的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.109ex" height="2.333ex" role="img" focusable="false" viewBox="0 -826 490 1031"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat y"><g data-mml-node="TeXAtom" data-latex="\hat y" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mo" transform="translate(304,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g></g></g></svg></mjx-container></span>值。</p>
<p>总结一下：Nadaraya-Watson核回归的注意力汇聚是对训练数据中输出的加权平均。从注意力的角度来看，分配给每个值的注意力权重取决于将值所对应的键和查询作为输入的函数。</p>
<p>英文版教材的实现更为简单，没有引入Q/K/V的概念而是直接按定义计算预测结果，测试了不同核函数对拟合效果的影响。最后选择高斯核测试了不同参数值（核宽度）对结果的影响：核越窄，估计结果就越不平滑，注意力权重的范围也越窄；同时，它对局部变化的适应性也更好。</p>
<p><strong>因此，选择相同的宽度可能并非理想之选，这说明了手工设计的注意力机制的局限性，更好的策略是学习该机制，即学习查询和键的表示。</strong></p>
<blockquote>
<p>英文版有个很有意思的习题：基于Parzen窗口密度估计公式<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.271ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 1888 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}) = \frac{1}{n} \sum_i k(\mathbf{x}, \mathbf{x}_i)"><g data-mml-node="TeXAtom" data-latex="\hat{p}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" transform="translate(343.5,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(892,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(1499,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.798ex;" xmlns="http://www.w3.org/2000/svg" width="15.658ex" height="2.755ex" role="img" focusable="false" viewBox="0 -864.9 6920.9 1217.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}) = \frac{1}{n} \sum_i k(\mathbf{x}, \mathbf{x}_i)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{1}{n}" transform="translate(1055.8,0)"><g data-mml-node="mn" transform="translate(255.4,394) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mi" transform="translate(220,-345) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><rect width="624.3" height="60" x="120" y="220"/></g><g data-mml-node="munder" data-latex="\sum_i" transform="translate(2086.7,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,-285.4) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mi" data-latex="k" transform="translate(3636.3,0)"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4157.3,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(4546.3,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5153.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(5598,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6531.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，通过<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.506ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 2433.7 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}, y=1) - \hat{p}(\mathbf{x}, y=-1)"><g data-mml-node="TeXAtom" data-latex="\hat{p}" data-mjx-texclass="ORD"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" transform="translate(343.5,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(503,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(892,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1499,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="y" transform="translate(1943.7,0)"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.4ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1944.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}, y=1) - \hat{p}(\mathbf{x}, y=-1)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1555.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="7.769ex" height="2.434ex" role="img" focusable="false" viewBox="0 -826 3433.9 1076"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}, y=1) - \hat{p}(\mathbf{x}, y=-1)"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="TeXAtom" data-latex="\hat{p}" data-mjx-texclass="ORD" transform="translate(1000.2,0)"><g data-mml-node="mover"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mo" transform="translate(343.5,32) translate(-250 0)"><path data-c="2C6" d="M386 515L403 533L250 694L97 533L114 515L250 618Z"/></g></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1503.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD" transform="translate(1892.2,0)"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(2499.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="y" transform="translate(2943.9,0)"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.76ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 778 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}, y=1) - \hat{p}(\mathbf{x}, y=-1)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.771ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1667 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\hat{p}(\mathbf{x}, y=1) - \hat{p}(\mathbf{x}, y=-1)"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(778,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(1278,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>将其用于二分类，其结果等价于Nadaraya-Watson分类。这是因为：</p>
<ol>
<li>Parzen窗口密度估计公式的含义是，在<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>处的估计密度等于所有训练样本对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="1.005ex" role="img" focusable="false" viewBox="0 -444 607 444"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{x}"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g></g></g></svg></mjx-container></span>的核相似度做平均，可以类比为直方图的光滑升级版（由统计固定区间内样本数量，变成了用核函数对所有样本给出一个相似度后求和平均）</li>
<li>Parzen窗口二分类是先估计两类的联合密度，做密度相减，看谁更大，以此做分类</li>
<li>这等价于用核相似度对标签<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.848ex" height="1.464ex" role="img" focusable="false" viewBox="0 -442 817 647"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="y_i"><g data-mml-node="msub" data-latex="y_i"><g data-mml-node="mi" data-latex="y"><path data-c="1D466" d="M163 442C118 442 83 417 58 367C39 328 29 301 29 286C29 277 34 272 45 272C59 272 60 278 64 293C87 372 119 412 160 412C173 412 180 403 180 385C180 369 175 346 164 317C126 214 107 145 107 108C107 32 154-13 231-13C264-13 295-1 323 23C288-109 233-175 158-175C124-175 101-164 89-142C129-140 149-121 149-85C149-60 136-47 109-47C72-47 50-78 50-115C50-170 100-205 158-205C273-205 367-99 392-1L486 377C489 388 490 396 490 401C490 421 479 431 458 431C442 431 429 423 420 408C414 387 409 369 406 354L342 97C332 61 279 16 234 16C196 16 177 41 177 92C177 134 194 198 227 284C240 319 247 343 247 357C247 406 212 442 163 442Z"/></g><g data-mml-node="mi" transform="translate(523,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>做加权平均，看加权平均的结果符号做分类</li>
</ol>
</blockquote>
<h2><a id="toc-82f" class="anchor" href="#toc-82f"></a>注意力评分函数（Attention Scoring Functions）</h2><p>前面我们使用高斯核来对Q与K之间的关系建模，高斯核指数部分可以视为注意力评分函数。</p>
<p>用数学语言描述，注意力汇聚函数表示成V的加权和：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="47.695ex" height="6.24ex" role="img" focusable="false" viewBox="0 -1562.5 21081.1 2758.3"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f(\mathbf{q}, (\mathbf{k}_1, \mathbf{v}_1), \ldots, (\mathbf{k}_m, \mathbf{v}_m)) = \sum_{i=1}^m \alpha(\mathbf{q}, \mathbf{k}_i) \mathbf{v}_i \in \mathbb{R}^v"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(552,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(941,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1548,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(1992.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_1" transform="translate(2381.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mn" transform="translate(640,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3425.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{v}_1" transform="translate(3869.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mn" transform="translate(640,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4913.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(5302.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(5747.1,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(6750.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(7195.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_m" transform="translate(7584.4,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(8895.3,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{v}_m" transform="translate(9339.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(10650.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(11039.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(11706.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{i=1}^m" transform="translate(12762.3,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(148.2,-1087.9) scale(0.707)" data-latex="{i=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(345,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1123,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(411.6,1150) scale(0.707)" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g></g><g data-mml-node="mi" data-latex="\alpha" transform="translate(14373,0)"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(15013,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(15402,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(16009,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_i" transform="translate(16453.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(17387.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\mathbf{v}_i" transform="translate(17776.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex="\in" transform="translate(18988.4,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^v" transform="translate(19933.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="mi" transform="translate(755,413) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>其中，注意力权重（标量）是通过<strong>注意力评分函数</strong><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.197ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 529 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g></g></g></svg></mjx-container></span>将两个向量映射成标量，再经过softmax运算得到的：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.669ex;" xmlns="http://www.w3.org/2000/svg" width="54.576ex" height="5.964ex" role="img" focusable="false" viewBox="0 -1456 24122.6 2635.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\alpha(\mathbf{q}, \mathbf{k}_i) = \mathrm{softmax}(a(\mathbf{q}, \mathbf{k}_i)) = \frac{\exp(a(\mathbf{q}, \mathbf{k}_i))}{\sum_{j=1}^m \exp(a(\mathbf{q}, \mathbf{k}_j))} \in \mathbb{R}"><g data-mml-node="mi" data-latex="\alpha"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(640,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(1029,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1636,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_i" transform="translate(2080.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3014.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(3681.4,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathrm{softmax}" data-mjx-texclass="ORD" transform="translate(4737.2,0)"><g data-mml-node="mi" data-latex="softmax"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(394,0)"/><path data-c="66" d="M265 705C176 705 110 633 110 544L110 434L33 434L33 396L110 396L110 79C110 60 107 48 100 44C93 40 71 39 34 39L34 0L149 3C191 4 234 3 277 0L277 39L253 39C220 39 199 41 192 46C185 51 182 63 182 81L182 396L294 396L294 434L179 434L179 545C179 605 210 675 265 675C273 675 280 674 287 672C272 664 264 650 264 631C264 600 279 584 310 584C341 584 357 600 357 632C357 677 310 705 265 705Z" transform="translate(894,0)"/><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z" transform="translate(1200,0)"/><path data-c="6D" d="M315 413C361 413 384 378 384 307L384 79C384 60 381 48 374 44C367 40 344 38 307 38L307 0L423 3L538 0L538 38C501 38 479 40 472 44C465 48 461 60 461 79L461 259C461 339 513 413 590 413C637 413 660 378 660 307L660 79C660 60 656 48 649 44C642 40 619 38 582 38L582 0L698 3L813 0L813 38C781 38 760 39 750 42C740 45 736 52 736 64L736 251C736 298 734 331 731 350C721 411 676 442 597 442C534 442 487 413 455 354C441 413 397 442 322 442C259 442 211 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L148 3L263 0L263 38C226 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 238 413 315 413Z" transform="translate(1589,0)"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(2422,0)"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(2922,0)"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(8187.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(8576.2,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(9105.2,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(9494.2,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(10101.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_i" transform="translate(10545.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11479.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(11868.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(12535.6,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mfrac" data-latex="\frac{\exp(a(\mathbf{q}, \mathbf{k}_i))}{\sum_{j=1}^m \exp(a(\mathbf{q}, \mathbf{k}_j))}" transform="translate(13591.3,0)"><g data-mml-node="mrow" data-latex="\exp(a(\mathbf{q}, \mathbf{k}_i))" transform="translate(1494,708)"><g data-mml-node="mi" data-latex="\exp"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(1528,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1528,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(1917,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2446,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(2835,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(3442,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_i" transform="translate(3886.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4820.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(5209.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mrow" data-latex="\sum_{j=1}^m \exp(a(\mathbf{q}, \mathbf{k}_j))" transform="translate(220,-749.6)"><g data-mml-node="munderover" data-latex="\sum_{j=1}^m"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M56 713L417 216L67-217C60-225 57-231 57-235C57-245 67-250 88-250L913-250L1001 5L967 5C954-33 933-66 902-95C825-166 719-188 565-188L152-188L490 232C497 240 500 246 500 250C500 254 498 259 493 266L175 702L560 702C682 702 764 691 854 644C907 616 944 571 967 510L1001 510L913 750L88 750C57 750 56 746 56 713Z"/></g><g data-mml-node="mi" transform="translate(1089,477.1) scale(0.707)" data-latex="m"><path data-c="1D45A" d="M657 442C596 442 543 412 498 353C489 412 451 442 383 442C324 442 273 416 231 363C223 407 188 442 137 442C96 442 66 409 45 344C34 312 29 293 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 66 299C84 375 107 413 134 413C152 413 161 399 161 371C161 358 156 331 145 290L88 63C84 51 79 25 79 19C79-1 90-11 111-11C131-11 145-1 152 19C153 24 160 49 171 92L192 181L222 295C233 318 250 341 272 365C301 397 337 413 380 413C413 413 429 391 429 348C429 335 424 308 414 267L387 153C380 124 364 64 356 32C355 25 354 21 354 19C354-1 365-11 387-11C398-11 406-8 413-1C428 14 429 21 435 48L494 285C497 298 511 321 535 353C565 393 605 413 654 413C687 413 703 391 703 348C703 309 683 236 642 129C633 106 629 87 629 74C629 25 666-11 714-11C759-11 793 14 818 64C838 104 848 131 848 144C848 153 843 158 832 158C825 157 818 148 813 137C791 58 759 18 716 18C703 18 696 28 696 47C696 62 702 84 714 115C755 222 775 295 775 333C775 404 728 442 657 442Z"/></g><g data-mml-node="TeXAtom" transform="translate(1089,-285.4) scale(0.707)" data-latex="{j=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(412,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1190,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mi" data-latex="\exp" transform="translate(2500.7,0)"><path data-c="65" d="M415 251C415 366 348 448 236 448C176 448 126 425 85 378C47 334 28 281 28 220C28 157 49 104 91 58C133 12 185-11 247-11C304-11 348 9 378 48C403 81 415 105 415 121C415 131 409 136 398 136C390 136 385 131 382 120C360 54 317 21 253 21C208 21 173 42 146 85C127 116 118 163 117 227L387 227C409 227 415 229 415 251M326 349C337 316 342 284 342 255L118 255C121 321 138 366 168 389C193 409 215 419 236 419C281 419 311 396 326 349Z"/><path data-c="78" d="M418 3C441 4 474 3 516 0L516 38C463 38 443 39 422 67L292 235C335 288 364 324 380 343C408 375 447 392 498 393L498 431C470 429 442 428 414 428C377 428 344 429 315 431L315 393C334 391 344 382 344 366C344 357 339 346 330 334L272 262L198 357C193 364 190 369 190 372C190 385 202 392 225 393L225 431L114 428C88 427 56 428 17 431L17 393C53 393 76 390 86 385C96 380 112 363 134 334L229 210C180 147 150 109 139 96C107 57 65 38 12 38L12 0C49 3 77 4 98 3L195 0L195 38C176 41 167 50 167 65C167 69 168 74 170 79C176 92 203 126 251 183L323 89C334 75 340 65 343 59C343 46 331 39 307 38L307 0Z" transform="translate(444,0)"/><path data-c="70" d="M298-13C360-13 413 9 456 54C499 99 521 152 521 215C521 276 501 328 462 372C421 419 371 442 311 442C260 442 216 422 178 383L178 442L28 431L28 393C65 393 87 391 94 386C101 381 105 368 105 347L105-115C105-134 101-146 94-150C87-154 65-155 28-155L28-194L142-191L257-194L257-155C220-155 199-154 192-150C185-146 181-134 181-115L181 44C203 13 246-13 298-13M304 409C345 409 377 386 402 340C421 301 431 260 431 215C431 168 420 125 398 86C372 39 337 16 294 16C252 16 219 36 194 75C185 88 181 101 181 114L181 333C210 384 251 409 304 409Z" transform="translate(972,0)"/></g><g data-mml-node="mo" transform="translate(4028.7,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(4028.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="a" transform="translate(4417.7,0)"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4946.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD" transform="translate(5335.7,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5942.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{k}_j" transform="translate(6387.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7368.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(7757.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><rect width="8346.7" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\in" transform="translate(22455.8,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD" transform="translate(23400.6,0)"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>选择不同的注意力评分函数会导致不同的注意力汇聚操作。有两个流行的评分函数：</p>
<table>
<thead>
<tr>
<th>对比维度</th>
<th>加性注意力</th>
<th>缩放点积注意力</th>
</tr>
</thead>
<tbody><tr>
<td>计算公式</td>
<td><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.71ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2965.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a(\mathbf q, \mathbf k) = \mathbf w_v^\top \text{tanh}(\mathbf W_q\mathbf q + \mathbf W_k \mathbf k)"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(529,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf q" data-mjx-texclass="ORD" transform="translate(918,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1525,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf k" data-mjx-texclass="ORD" transform="translate(1969.7,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2576.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.65ex;" xmlns="http://www.w3.org/2000/svg" width="16.083ex" height="2.533ex" role="img" focusable="false" viewBox="0 -832.5 7108.5 1119.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a(\mathbf q, \mathbf k) = \mathbf w_v^\top \text{tanh}(\mathbf W_q\mathbf q + \mathbf W_k \mathbf k)"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf w_v^\top" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf w" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="w"><path data-c="1D430" d="M805 397L805 444C782 442 752 441 728 441L632 444L632 397C641 397 690 396 690 385C690 382 687 376 686 373L581 117L467 397L523 397L523 444L409 441C367 441 325 443 309 444L309 397L368 397C389 347 389 344 389 344C389 340 386 334 385 331L306 139L201 397L257 397L257 444L134 441L25 444L25 397L84 397L237 23C244 6 248-4 273-4C298-4 302 6 309 23L415 282L521 23C528 6 532-4 557-4C582-4 586 6 593 23L737 376C742 389 746 397 805 397Z"/></g></g><g data-mml-node="mi" transform="translate(864,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g><g data-mml-node="mi" transform="translate(864,-247) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g><g data-mml-node="mtext" data-latex="\text{tanh}" transform="translate(2519.9,0)"><path data-c="74" d="M332 126L332 186L300 186L300 128C300 78 282 22 238 22C197 22 177 56 177 124L177 395L316 395L316 433L177 433L177 615L145 615C144 582 141 553 134 527C117 461 78 427 19 424L19 395L102 395L102 126C102 67 120 29 155 10C182-4 207-11 232-11C298-11 332 55 332 126Z"/><path data-c="61" d="M483 91L483 150L451 150L451 91C451 52 440 32 419 32C399 32 387 57 387 77L387 274C387 309 383 335 376 353C352 412 283 448 213 448C136 448 60 405 60 333C60 300 77 283 110 283C143 283 159 299 159 332C159 361 144 378 113 381C135 406 168 419 211 419C273 419 311 362 311 297L311 264C233 259 174 247 133 228C66 197 32 154 32 97C32 71 42 49 61 32C93 3 137-11 193-11C252-11 294 14 320 65C327 27 355-6 398-6C451-6 483 36 483 91M200 18C154 18 116 52 116 98C116 191 213 231 311 236L311 141C311 74 267 18 200 18Z" transform="translate(389,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(889,0)"/><path data-c="68" d="M314 415C359 415 382 380 382 309L382 79C382 60 379 48 372 44C365 40 343 39 306 39L306 0L421 3L535 0L535 39C503 39 482 40 472 43C462 46 458 53 458 64L458 253C458 301 457 334 454 353C444 414 399 445 320 445C259 445 213 417 182 361L182 694L32 683L32 645C68 645 90 642 98 636C106 630 109 616 109 593L109 79C109 60 105 48 98 44C91 40 69 39 32 39L32 0L147 3L261 0L261 39C224 39 203 40 196 44C189 48 185 60 185 79L185 261C185 342 236 415 314 415Z" transform="translate(1445,0)"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4520.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf W_q" transform="translate(4909.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf q" data-mjx-texclass="ORD" transform="translate(6501.5,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="8.228ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 3636.6 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a(\mathbf q, \mathbf k) = \mathbf w_v^\top \text{tanh}(\mathbf W_q\mathbf q + \mathbf W_k \mathbf k)"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="msub" data-latex="\mathbf W_k" transform="translate(1000.2,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf k" data-mjx-texclass="ORD" transform="translate(2640.6,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3247.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span></td>
<td><span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.71ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2965.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a(\mathbf q, \mathbf k) = \mathbf{q}^\top \mathbf{k}  /\sqrt{d}"><g data-mml-node="mi" data-latex="a"><path data-c="1D44E" d="M498 144C498 153 493 158 482 158C474 158 468 151 465 137C445 58 421 18 394 18C377 18 368 32 368 60C368 73 372 97 381 132L438 357C443 376 445 387 445 392C445 412 434 422 412 422C391 422 377 410 370 387C349 424 319 442 281 442C216 442 159 409 109 343C63 281 40 217 40 150C40 63 91-11 175-11C218-11 260 12 300 58C311 20 345-11 392-11C461-11 482 70 498 144M341 374C350 353 355 339 355 330C355 326 354 321 353 314L304 122C301 111 294 99 285 87C248 41 212 18 177 18C138 18 118 48 118 107C118 131 124 167 136 215C157 300 187 357 224 388C244 405 263 413 282 413C309 413 329 400 341 374Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(529,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf q" data-mjx-texclass="ORD" transform="translate(918,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(1525,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf k" data-mjx-texclass="ORD" transform="translate(1969.7,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2576.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="10.805ex" height="2.758ex" role="img" focusable="false" viewBox="0 -969 4775.9 1219"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="a(\mathbf q, \mathbf k) = \mathbf{q}^\top \mathbf{k}  /\sqrt{d}"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msup" data-latex="\mathbf{q}^\top" transform="translate(1055.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mi" transform="translate(640,363) scale(0.707)" data-latex="\top"><path data-c="22A4" d="M698 664L80 664C64 664 56 656 56 640C56 625 64 617 80 617L365 617L365 4C365-12 373-20 389-20C405-20 413-12 413 4L413 617L698 617C714 617 722 625 722 640C722 653 711 664 698 664Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD" transform="translate(2295.9,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mo" data-latex="/" transform="translate(2902.9,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="msqrt" data-latex="\sqrt{d}" transform="translate(3402.9,0)"><g data-mml-node="mo" transform="translate(0,869)"><path data-c="221A" d="M847-2C851 7 853 13 853 16C853 32 845 40 829 40C820 40 813 36 809 27C666-259 595-403 595-405L595-406C595-413 527-558 390-843L217-461C212-450 207-445 201-445C198-445 192-448 184-454L86-528C77-535 73-540 73-545C73-555 78-560 87-560C90-560 95-557 103-551L151-516L345-943C350-954 357-960 367-960C379-960 387-955 392-946Z"/></g><g transform="translate(853,0)"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g><rect width="520" height="60" x="853" y="849"/></g></g></g></svg></mjx-container></span></td>
</tr>
<tr>
<td>使用条件</td>
<td>可以处理Q和K的向量长度不一致的情况</td>
<td>要求Q和K具有相同的长度<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.176ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 520 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="d"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></svg></mjx-container></span>（否则无法通过点积计算相似度）<br />即<code>查询的特征向量的维数</code>与<code>键的特征向量的维数</code>相同</td>
</tr>
<tr>
<td>Q的形状</td>
<td><code>(批量大小, 查询数量, 查询的特征向量的维数)</code></td>
<td></td>
</tr>
<tr>
<td>K的形状</td>
<td><code>(批量大小, 键值对数量, 键的特征向量的维数)</code></td>
<td></td>
</tr>
<tr>
<td>V的形状</td>
<td><code>(批量大小, 键值对数量, 标签向量的维度)</code></td>
<td></td>
</tr>
<tr>
<td>权重矩阵的形状</td>
<td><code>(批量大小, 查询数量, 键值对数量)</code></td>
<td></td>
</tr>
<tr>
<td>注意力汇聚输出的形状</td>
<td><code>(批量大小, 查询数量, 标签向量的维度)</code></td>
<td></td>
</tr>
</tbody></table>
<p>在某些情况下，并非所有的值都应该被纳入到注意力汇聚中（例如<code>&lt;pad&gt;</code>词元），所以我们需要对注意力权重计算中的softmax做改造，变成masked_softmax，以按需求遮蔽掉权重矩阵第三维（键值对数量）中的部分数据。</p>
<p>英文版教材还额外提到了：高斯核注意力，在LayerNorm加持下，可以简化成量点积。这是一个很重要的视角：<strong>缩放点积注意力可以看作高斯核注意力的简化版本</strong>。解释一下：高斯核本质上计算的是向量之间的距离，那么当两个向量的范数是常数时，剩下的就是向量之间的点积，因此可以用向量之间的点积来表达向量之间的距离。而距离代表了相似度，所以向量点积就代表了相似度。</p>
<h2><a id="toc-6fa" class="anchor" href="#toc-6fa"></a>Bahdanau注意力（The Bahdanau Attention Mechanism）</h2><div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>本节使用的<code>d2l.AdditiveAttention</code>做了简化，通过使用LazyLinear，省略了<code>查询的特征向量的维数</code>和<code>键的特征向量的维数</code>两个参数的传入。要想继续使用教材上的代码，需要把库代码改一下。</p>
</div>
<p><strong>Bahdanau注意力相比Cho et al., 2014只是将每次传给decoder用于拼接到输入上的状态（称为context），从encoder最后一个时间步的状态，改为encoder所有时间步的状态的加权和。</strong></p>
<p>也就是说，在时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.656ex" height="1.724ex" role="img" focusable="false" viewBox="0 -751.2 731.8 762.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t'"><g data-mml-node="msup" data-latex="t'"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,363) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g></g></g></svg></mjx-container></span>的context通过下式计算：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -2.705ex;" xmlns="http://www.w3.org/2000/svg" width="22.242ex" height="6.616ex" role="img" focusable="false" viewBox="0 -1728.7 9831 2924.4"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{c}_{t'} = \sum_{t=1}^T \alpha(\mathbf{s}_{t' - 1}, \mathbf{h}_t) \mathbf{h}_t"><g data-mml-node="msub" data-latex="\mathbf{c}_{}"><g data-mml-node="TeXAtom" data-latex="\mathbf{c}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="c"><path data-c="1D41C" d="M478 117C478 131 464 131 454 131C436 131 435 129 430 116C404 53 356 34 305 34C166 34 166 181 166 227C166 283 166 413 295 413C330 413 347 410 360 407C342 391 340 370 340 361C340 317 375 298 402 298C433 298 465 319 465 361C465 447 349 453 291 453C112 453 38 338 38 222C38 89 132-6 286-6C448-6 478 110 478 117Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(544,-150) scale(0.707)" data-latex="{}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g></g></g><g data-mml-node="mo" data-latex="=" transform="translate(1389.2,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="munderover" data-latex="\sum_{t=1}^T" transform="translate(2445,0)"><g data-mml-node="mo" data-latex="\sum"><path data-c="2211" d="M1265-450L1389-124L1355-124C1336-174 1304-216 1258-250C1145-334 1000-356 791-356L200-356L700 232C707 239 710 246 710 251L244 894L781 894C970 894 1127 870 1230 804C1290 766 1332 719 1356 663L1389 663L1265 950L88 950C70 950 60 947 57 941C56 938 56 926 56 905L581 187L68-415C61-423 57-430 57-435C57-445 67-450 88-450Z"/></g><g data-mml-node="TeXAtom" transform="translate(142.5,-1087.9) scale(0.707)" data-latex="{t=1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" data-latex="=" transform="translate(361,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1139,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mi" transform="translate(473.1,1150) scale(0.707)" data-latex="T"><path data-c="1D447" d="M344 631C344 628 343 621 340 611L208 83C204 68 200 59 197 55C188 44 154 39 94 39C63 39 49 42 49 16C49 5 56 0 69 0C120 0 192 4 235 3L317 2C331 2 386 0 403 0C420 0 428 8 428 24C428 34 416 39 391 39C339 39 309 41 300 46C297 48 295 52 295 58L430 603C433 617 436 626 439 629C443 635 467 638 511 638C566 638 604 634 623 625C642 616 652 595 652 561C652 543 649 517 644 483C642 475 641 469 641 464C641 453 646 447 657 447C666 447 672 456 675 473L702 645C703 650 704 656 704 662C704 672 694 677 673 677L125 677C99 677 97 674 89 655L30 481C27 472 25 466 24 462C24 452 29 447 40 447C48 447 55 455 60 470C85 543 110 588 133 607C159 628 209 638 282 638L321 638C332 638 344 639 344 631Z"/></g></g><g data-mml-node="mi" data-latex="\alpha" transform="translate(4055.7,0)"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4695.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{s}_{-1}" transform="translate(5084.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{s}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="s"><path data-c="1D42C" d="M415 140C415 183 395 218 360 246C321 275 289 281 211 294C174 301 109 312 109 359C109 421 202 421 221 421C296 421 334 392 339 337C340 322 341 317 362 317C386 317 386 322 386 345L386 425C386 444 386 453 368 453C364 453 362 453 323 434C297 447 262 453 222 453C192 453 38 453 38 322C38 282 58 255 78 238C118 203 156 197 233 183C269 177 344 164 344 105C344 30 252 30 230 30C124 30 98 103 86 146C81 160 76 160 62 160C38 160 38 154 38 131L38 22C38 3 38-6 56-6C63-6 65-6 86 9L112 26C158-6 210-6 230-6C261-6 415-6 415 140Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(487,-150) scale(0.707)" data-latex="{-1}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(731.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1509.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(7042.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{h}_t" transform="translate(7487.5,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(8464.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\mathbf{h}_t" transform="translate(8853.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>其中，时间步<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.656ex" height="2.265ex" role="img" focusable="false" viewBox="0 -751.2 731.8 1001.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t' - 1"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,363) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="t' - 1"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>时的解码器隐状态<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.472ex;" xmlns="http://www.w3.org/2000/svg" width="4.43ex" height="1.497ex" role="img" focusable="false" viewBox="0 -453 1958.1 661.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{s}_{t' - 1}"><g data-mml-node="msub" data-latex="\mathbf{s}_{t' - 1}"><g data-mml-node="TeXAtom" data-latex="\mathbf{s}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="s"><path data-c="1D42C" d="M415 140C415 183 395 218 360 246C321 275 289 281 211 294C174 301 109 312 109 359C109 421 202 421 221 421C296 421 334 392 339 337C340 322 341 317 362 317C386 317 386 322 386 345L386 425C386 444 386 453 368 453C364 453 362 453 323 434C297 447 262 453 222 453C192 453 38 453 38 322C38 282 58 255 78 238C118 203 156 197 233 183C269 177 344 164 344 105C344 30 252 30 230 30C124 30 98 103 86 146C81 160 76 160 62 160C38 160 38 154 38 131L38 22C38 3 38-6 56-6C63-6 65-6 86 9L112 26C158-6 210-6 230-6C261-6 415-6 415 140Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(487,-150) scale(0.707)" data-latex="{-1}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(731.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1509.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>是查询，编码器隐状态<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.211ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 977.3 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{h}_t"><g data-mml-node="msub" data-latex="\mathbf{h}_t"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g></g></g></g></svg></mjx-container></span>既是键也是值，注意力权重<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.448ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 640 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\alpha"><g data-mml-node="mi" data-latex="\alpha"><path data-c="1D6FC" d="M310 442C241 442 179 412 124 353C69 294 41 229 41 159C41 61 107-11 205-11C274-11 342 16 410 69C425 16 456-11 502-11C538-11 589 27 589 63C589 72 584 76 573 76C566 76 560 72 557 64C549 43 528 18 505 18C488 18 479 50 479 115C479 129 482 140 488 147C515 180 539 218 558 260C583 314 598 354 602 380L602 384C599 391 593 394 586 394C581 393 575 385 568 371C547 299 518 237 479 186L479 236C479 352 421 442 310 442M403 211C403 152 404 116 405 103C340 46 274 18 207 18C150 18 122 53 122 122C122 180 155 288 178 324C216 383 260 413 309 413C340 413 361 401 374 377C381 365 386 353 391 342C399 319 403 258 403 211Z"/></g></g></g></svg></mjx-container></span>使用加性注意力打分函数。</p>
<p>这里要使用<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.472ex;" xmlns="http://www.w3.org/2000/svg" width="4.43ex" height="1.497ex" role="img" focusable="false" viewBox="0 -453 1958.1 661.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{s}_{t' - 1}"><g data-mml-node="msub" data-latex="\mathbf{s}_{t' - 1}"><g data-mml-node="TeXAtom" data-latex="\mathbf{s}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="s"><path data-c="1D42C" d="M415 140C415 183 395 218 360 246C321 275 289 281 211 294C174 301 109 312 109 359C109 421 202 421 221 421C296 421 334 392 339 337C340 322 341 317 362 317C386 317 386 322 386 345L386 425C386 444 386 453 368 453C364 453 362 453 323 434C297 447 262 453 222 453C192 453 38 453 38 322C38 282 58 255 78 238C118 203 156 197 233 183C269 177 344 164 344 105C344 30 252 30 230 30C124 30 98 103 86 146C81 160 76 160 62 160C38 160 38 154 38 131L38 22C38 3 38-6 56-6C63-6 65-6 86 9L112 26C158-6 210-6 230-6C261-6 415-6 415 140Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(487,-150) scale(0.707)" data-latex="{-1}" data-mjx-texclass="ORD"><g data-mml-node="msup"><g data-mml-node="mi" data-latex="t"><path data-c="1D461" d="M330 419C330 428 320 433 299 433L218 433C244 537 257 591 257 595C257 616 246 626 225 626C202 626 188 613 182 587L145 433L56 433C34 433 23 432 23 411C23 400 33 395 54 395L135 395C86 200 62 97 62 84C62 28 100-11 156-11C194-11 227 6 256 41C280 70 297 98 308 125C312 136 314 142 314 145C314 154 309 159 299 159C291 159 285 154 281 143C247 60 206 19 157 19C140 19 131 33 131 60C131 75 133 91 137 107L208 395L297 395C323 395 330 397 330 419Z"/></g><g data-mml-node="mo" transform="translate(394,289) scale(0.707)" data-latex="'"><path data-c="2032" d="M284 549C259 549 242 539 233 518L65 96L110 96L332 463C337 472 340 482 340 493C340 523 314 549 284 549Z"/></g></g><g data-mml-node="mo" data-latex="-" transform="translate(731.8,0)"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1509.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></svg></mjx-container></span>作为查询而不是当前时间步的输入嵌入向量，是因为查询需要表达当前解码的完整语义需求，即：当前我（解码器）已经生成了这些内容，接下来我需要从源序列里调取哪部分信息。</p>
<p>接下来讨论一些实现上的细节。</p>
<p>本节的<code>Seq2SeqAttentionDecoder</code>相比之前的<code>Seq2SeqEncoder</code>有个不同点是：</p>
<ul>
<li>之前的<code>Seq2SeqEncoder</code>在forward中直接用<code>self.rnn</code>处理所有时间步。</li>
<li>本节的<code>Seq2SeqAttentionDecoder</code>在forward中手动做num_steps的循环，这是因为每个时间步需要的输入不同（在每步RNN计算之间插入动态注意力计算），没办法在<code>self.rnn</code>内部直接处理所有时间步。</li>
</ul>
<p>为了更好地看清楚代码，回顾和分析一下几个点：</p>
<ul>
<li>nn.LSTM的输出是一个元组(output, (h_n, c_n))<ul>
<li>output是最后一层每个时间步的隐藏状态，形状为<code>(num_steps, batch_size, num_directions * num_hiddens)</code></li>
<li>h_n是所有层在最后时间步的隐藏状态，形状为<code>(num_layers * num_directions, batch_size, num_hiddens)</code></li>
<li>c_n是所有层在最后时间步的记忆状态，形状与h_n相同</li>
</ul>
</li>
<li>一共有两个地方用到mask<ol>
<li>decoder在计算权重矩阵时，忽略掉词元为<code>&lt;pad&gt;</code>的键值对（用的是原文）</li>
<li>计算损失时，忽略掉词元为<code>&lt;pad&gt;</code>的时间步所产生的损失（用的是译文）</li>
</ol>
<ul>
<li>教材中的encoder用原文计算出隐状态的过程，并没有忽略掉<code>&lt;pad&gt;</code>（但训推是一致的，都没有忽略）</li>
</ul>
</li>
</ul>
<h2><a id="toc-593" class="anchor" href="#toc-593"></a>多头注意力（Multi-Head Attention）</h2><p>前面我们使用的注意力只有一组Q/KV投影，只能学习一种类型的依赖关系，而现实中的依赖关系是多种多样的：有的是短距离依赖，有的是长距离依赖，还有语法、语义、指代等不同模式的关系。因此我们希望模型在同一套QKV输入下，可以同时学到多种不同的注意力行为，再把这些知识组合起来。</p>
<p>要想实现这一点，我们需要将原本的一组QKV扩展到多组，通过可学习的全连接层得到多份不同的QKV，这称为<strong>多头注意力</strong>。每个头的投影权重完全独立学习，得到不同子空间表示。</p>
<p>给定查询<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 607 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{q} \in \mathbb{R}^{d_q}"><g data-mml-node="TeXAtom" data-latex="\mathbf{q}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.435ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 2402.2 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{q} \in \mathbb{R}^{d_q}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{d_q}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{d_q}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_q"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></g></svg></mjx-container></span>、键<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 607 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{k} \in \mathbb{R}^{d_k}"><g data-mml-node="TeXAtom" data-latex="\mathbf{k}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.513ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 2436.7 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{k} \in \mathbb{R}^{d_k}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{d_k}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{d_k}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_k"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></g></g></g></svg></mjx-container></span>和值<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.373ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 607 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v} \in \mathbb{R}^{d_v}"><g data-mml-node="TeXAtom" data-latex="\mathbf{v}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.472ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 2418.7 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{v} \in \mathbb{R}^{d_v}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{d_v}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{d_v}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="d_v"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g></g></g></g></g></svg></mjx-container></span>，每个注意力头<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.357ex;" xmlns="http://www.w3.org/2000/svg" width="2.185ex" height="1.927ex" role="img" focusable="false" viewBox="0 -694 966 851.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{h}_i"><g data-mml-node="msub" data-latex="\mathbf{h}_i"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg></mjx-container></span>（<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 345 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i = 1, \ldots, h"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="9.106ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4024.8 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i = 1, \ldots, h"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1055.8,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1555.8,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(2000.4,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(3004.1,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(3448.8,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg></mjx-container></span>）的计算方法为：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="35.117ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 15521.6 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{h}_i = f(\mathbf W_i^{(q)}\mathbf q, \mathbf W_i^{(k)}\mathbf k,\mathbf W_i^{(v)}\mathbf v) \in \mathbb R^{p_v}"><g data-mml-node="msub" data-latex="\mathbf{h}_i"><g data-mml-node="TeXAtom" data-latex="\mathbf{h}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(1243.7,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(2299.5,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2851.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(q)}" transform="translate(3240.5,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(q)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(389,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(841,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf q" data-mjx-texclass="ORD" transform="translate(5382.2,0)"><g data-mml-node="mi" data-latex="q"><path data-c="1D42A" d="M601-194L601-147L532-147L532 450L491 450L438 371C403 420 347 450 287 450C141 450 38 361 38 222C38 81 139-6 278-6C327-6 372 8 418 48L418-147L349-147L349-194L475-191M424 142C424 124 424 121 409 100C369 41 318 30 288 30C226 30 166 88 166 221C166 363 240 410 300 410C376 410 424 331 424 281Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(5989.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(k)}" transform="translate(6433.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(k)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="k" transform="translate(389,0)"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(910,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf k" data-mjx-texclass="ORD" transform="translate(8624.4,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(9231.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(v)}" transform="translate(9676.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(v)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="v" transform="translate(389,0)"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(874,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf v" data-mjx-texclass="ORD" transform="translate(11841.2,0)"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12448.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\in" transform="translate(13115,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb R^{p_v}" transform="translate(14059.7,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb R" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,413) scale(0.707)" data-latex="{p_v}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_v"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>其中，可学习的参数包括<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="4.846ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 2141.7 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(q)}\in\mathbb R^{p_q\times d_q}"><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(q)}"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(q)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="q" transform="translate(389,0)"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(841,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="8.128ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3592.7 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(q)}\in\mathbb R^{p_q\times d_q}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb R^{p_q\times d_q}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb R" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{p_q\times d_q}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_q"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="mo" data-latex="\times" transform="translate(905.6,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="d_q" transform="translate(1683.6,0)"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g></g></g></g></g></svg></mjx-container></span>、<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="4.956ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 2190.5 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(k)}\in\mathbb R^{p_k\times d_k}"><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(k)}"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(k)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="k" transform="translate(389,0)"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(910,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="8.284ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3661.7 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(k)}\in\mathbb R^{p_k\times d_k}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb R^{p_k\times d_k}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb R" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{p_k\times d_k}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_k"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="mo" data-latex="\times" transform="translate(954.4,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="d_k" transform="translate(1732.4,0)"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="4.898ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 2165.1 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(v)}\in\mathbb R^{p_v\times d_v}"><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(v)}"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(v)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="v" transform="translate(389,0)"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(874,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="8.203ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3625.7 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(v)}\in\mathbb R^{p_v\times d_v}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb R^{p_v\times d_v}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb R" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{p_v\times d_v}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_v"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g><g data-mml-node="mo" data-latex="\times" transform="translate(928.9,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="msub" data-latex="d_v" transform="translate(1706.9,0)"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mi" transform="translate(553,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g></g></g></g></g></svg></mjx-container></span>，以及代表注意力汇聚的函数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.249ex" height="2.059ex" role="img" focusable="false" viewBox="0 -705 552 910"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg></mjx-container></span>。<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="1.249ex" height="2.059ex" role="img" focusable="false" viewBox="0 -705 552 910"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="f"><g data-mml-node="mi" data-latex="f"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g></g></g></svg></mjx-container></span>可以是加性注意力和缩放点积注意力。多头注意力的输出需要经过另一个线性转换，它对应着<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.303ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 576 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg></mjx-container></span>个头连结后的结果，因此其可学习参数是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.654ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1614.9 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_o\in\mathbb R^{p_o\times h p_v}"><g data-mml-node="msub" data-latex="\mathbf W_o"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="9.097ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 4020.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_o\in\mathbb R^{p_o\times h p_v}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb R^{p_o\times h p_v}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb R" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{p_o\times h p_v}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_o"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g><g data-mml-node="mo" data-latex="\times" transform="translate(928.9,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="h" transform="translate(1706.9,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g><g data-mml-node="msub" data-latex="p_v" transform="translate(2282.9,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g></g></g></g></g></svg></mjx-container></span>：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -3.733ex;" xmlns="http://www.w3.org/2000/svg" width="15.677ex" height="8.597ex" role="img" focusable="false" viewBox="0 -2150 6929.3 3800"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_o \begin{bmatrix}\mathbf h_1\\\vdots\\\mathbf h_h\end{bmatrix} \in \mathbb{R}^{p_o}"><g data-mml-node="msub" data-latex="\mathbf W_o"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g><g data-mml-node="mrow" data-latex="{bmatrix}" transform="translate(1781.6,0)"><g data-mml-node="mo"><path data-c="23A1" d="M614 1500L321 1500L321 0L387 0L387 1432L614 1432C636 1432 647 1443 647 1466C647 1485 633 1500 614 1500Z" transform="translate(0,650)"/><path data-c="23A3" d="M614 68L387 68L387 1500L321 1500L321 0L614 0C636 0 647 11 647 34C647 53 633 68 614 68Z" transform="translate(0,-1650)"/><svg width="667" height="940" y="-220" x="0" viewBox="0 235 667 940" xmlns="http://www.w3.org/2000/svg"><path data-c="23A2" d="M321 0L387 0L387 1000L321 1000Z" transform="scale(1,1.41)"/></svg></g><g data-mml-node="mtable" transform="translate(667,0)"><g data-mml-node="mtr" transform="translate(0,1400)"><g data-mml-node="mtd" transform="translate(26.9,0)"><g data-mml-node="msub" data-latex="\mathbf h_1"><g data-mml-node="TeXAtom" data-latex="\mathbf h" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mn" transform="translate(672,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtr"><g data-mml-node="mtd" transform="translate(455.6,0)"><g data-mml-node="mo" data-latex="\vdots"><path data-c="22EE" d="M162 526C162 556 139 582 109 582C79 582 56 556 56 526C56 495 79 469 109 469C139 469 162 496 162 526M162 250C162 280 139 306 109 306C79 306 56 281 56 250C56 219 79 194 109 194C139 194 162 220 162 250M162-26C162 5 139 31 109 31C79 31 56 5 56-26C56-56 79-82 109-82C139-82 162-56 162-26Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-1400)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="\mathbf h_h"><g data-mml-node="TeXAtom" data-latex="\mathbf h" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="h"><path data-c="1D421" d="M615 0L615 47L546 47L546 306C546 411 492 450 392 450C296 450 245 392 223 354L222 354L222 694L45 686L45 639C107 639 114 639 114 600L114 47L45 47L45 0L171 3L297 0L297 47L228 47L228 256C228 365 314 414 377 414C411 414 432 393 432 317L432 47L363 47L363 0L489 3Z"/></g></g><g data-mml-node="mi" transform="translate(672,-150) scale(0.707)" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></g></g><g data-mml-node="mo" transform="translate(1796.3,0)"><path data-c="23A4" d="M280 0L346 0L346 1500L53 1500C31 1500 20 1489 20 1466C20 1443 31 1432 53 1432L280 1432Z" transform="translate(0,650)"/><path data-c="23A6" d="M53 0L346 0L346 1500L280 1500L280 68L53 68C31 68 20 57 20 34C20 11 31 0 53 0Z" transform="translate(0,-1650)"/><svg width="667" height="940" y="-220" x="0" viewBox="0 235 667 940" xmlns="http://www.w3.org/2000/svg"><path data-c="23A5" d="M280 0L346 0L346 1000L280 1000Z" transform="scale(1,1.41)"/></svg></g></g><g data-mml-node="mo" data-latex="\in" transform="translate(4522.7,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{p_o}" transform="translate(5467.5,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,413) scale(0.707)" data-latex="{p_o}" data-mjx-texclass="ORD"><g data-mml-node="msub" data-latex="p_o"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>基于这种设计，每个头都可能会关注输入的不同部分，可以表示比简单加权平均值更复杂的函数。</p>
<p>在实现过程中通常选择缩放点积注意力作为每一个注意力头。<strong>为了避免计算代价和参数代价的大幅增长，往往设定<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.65ex;" xmlns="http://www.w3.org/2000/svg" width="3.352ex" height="2.347ex" role="img" focusable="false" viewBox="0 -750 1481.6 1037.2"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_q h = p_k h = p_v h = p_o"><g data-mml-node="msub" data-latex="p_q"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="q"><path data-c="1D45E" d="M372 377C352 420 321 442 280 442C215 442 158 409 109 342C63 280 40 216 40 149C40 62 90-13 173-13C209-13 245 4 282 38L241-126C238-141 229-150 215-153C210-154 197-155 174-155C168-156 164-156 162-156C153-157 148-165 148-179L148-183C151-190 157-194 165-194C184-194 244-191 263-191C282-191 345-194 364-194C378-194 385-186 385-170C385-160 375-155 356-155C338-155 313-156 313-144C313-140 314-133 317-123L452 427C452 436 447 441 438 441C420 441 382 391 372 377M340 373C349 352 354 338 354 329C354 328 353 322 351 313L327 216C308 144 299 107 298 105C279 70 224 16 176 16C137 16 117 46 117 105C117 151 148 263 162 300C181 347 225 412 280 412C307 412 327 399 340 373Z"/></g></g><g data-mml-node="mi" data-latex="h" transform="translate(905.6,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.851ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2586.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_q h = p_k h = p_v h = p_o"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="p_k" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="k"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g></g><g data-mml-node="mi" data-latex="h" transform="translate(2010.2,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="5.793ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 2560.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_q h = p_k h = p_v h = p_o"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="p_v" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="v"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g></g><g data-mml-node="mi" data-latex="h" transform="translate(1984.7,0)"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.49ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1984.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="p_q h = p_k h = p_v h = p_o"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="msub" data-latex="p_o" transform="translate(1055.8,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="mi" transform="translate(536,-150) scale(0.707)" data-latex="o"><path data-c="1D45C" d="M308 442C239 442 176 412 122 353C68 294 41 229 41 159C41 63 106-11 202-11C272-11 334 19 388 78C442 137 469 201 469 272C469 369 405 442 308 442M389 310C389 287 384 255 374 213C353 130 319 73 272 42C248 26 225 18 203 18C149 18 121 65 121 122C121 180 155 288 178 324C216 383 259 413 307 413C361 413 389 367 389 310Z"/></g></g></g></g></svg></mjx-container></span></strong>，也就是假设最终输出的隐状态是<code>num_hiddens</code>个，则每个注意力头输出<code>num_hiddens/h</code>个隐状态。这样参数<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.018ex;" xmlns="http://www.w3.org/2000/svg" width="2.69ex" height="1.57ex" role="img" focusable="false" viewBox="0 -686 1189 694"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g></g></g></svg></mjx-container></span>就不需要拆出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.303ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 576 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="h"><g data-mml-node="mi" data-latex="h"><path data-c="210E" d="M512 138C489 59 457 19 415 19C402 19 395 28 395 47C395 62 401 85 413 116C453 223 473 296 473 335C473 406 427 445 356 445C303 445 257 423 218 380L291 679C289 688 287 694 274 694C241 694 168 685 155 684C140 682 132 675 132 660C132 650 141 645 159 645C180 645 203 646 205 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C107-11 121-1 128 18L168 182C180 231 189 268 196 293C199 300 207 314 220 334C256 388 300 415 353 415C386 415 402 393 402 350C402 309 382 236 342 130C333 107 329 89 329 74C329 26 365-11 413-11C457-11 492 14 517 65C536 105 546 132 546 145C546 154 541 159 530 159C527 159 512 150 512 138Z"/></g></g></g></svg></mjx-container></span>个出来分别计算，直接串在一起统一做大张量计算即可（中间涉及到reshape和permute操作）。</p>
<h2><a id="toc-bac" class="anchor" href="#toc-bac"></a>自注意力和位置编码（Self-Attention and Positional Encoding）</h2><p>前面介绍机器翻译这种将序列分为原文和译文，并使用编码器-解码器架构的场景，由于Q和KV不同源，所以被称为<strong>交叉注意力</strong>。（Bahdanau注意力就是为了解决机器翻译场景在无注意力下固定上下文向量导致的信息丢失问题提出的一整套方法）</p>
<p>而对于序列预测场景，相比于裸用RNN，我们也可以加上注意力机制，由于是同一个序列内部做注意力，QKV完全同源，因此称为<strong>自注意力</strong>。用公式表示如下：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="36.256ex" height="2.606ex" role="img" focusable="false" viewBox="0 -903.7 16025.3 1151.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{y}_i = f(\mathbf{x}_i, (\mathbf{x}_1, \mathbf{x}_1), \ldots, (\mathbf{x}_n, \mathbf{x}_n)) \in \mathbb{R}^d"><g data-mml-node="msub" data-latex="\mathbf{y}_i"><g data-mml-node="TeXAtom" data-latex="\mathbf{y}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="y"><path data-c="1D432" d="M580 397L580 444C556 442 526 441 501 441L410 444L410 397C410 397 457 397 457 385L452 373L337 127L210 397L264 397L264 444L140 441L26 444L26 397L90 397L277 0L254-48C232-96 200-164 129-164C115-164 113-163 105-160C114-156 137-142 137-107C137-74 113-50 79-50C51-50 22-69 22-108C22-159 69-200 129-200C206-200 264-138 291-81L506 376C513 390 516 397 580 397Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex="=" transform="translate(1211.7,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="f" transform="translate(2267.5,0)"><path data-c="1D453" d="M552 633C552 677 509 705 462 705C400 705 357 665 334 586C329 568 318 517 302 433L237 433C215 433 204 432 204 411C204 400 214 395 235 395L295 395L222 8C211-49 201-91 192-119C180-156 163-175 141-175C126-175 114-171 103-164C135-159 151-140 151-108C151-82 138-69 111-69C77-69 53-99 53-133C53-177 94-205 141-205C166-205 189-195 208-174C240-141 265-94 283-31C294 8 304 46 311 84L369 395L451 395C474 395 484 396 484 419C484 428 474 433 454 433L377 433C383 474 411 625 420 644C430 665 444 675 462 675C477 675 490 671 501 664C470 657 454 639 454 608C454 582 467 569 494 569C528 569 552 599 552 633Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(2819.5,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_i" transform="translate(3208.5,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(4142.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(4587.1,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_1" transform="translate(4976.1,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mn" transform="translate(640,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(6019.7,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_1" transform="translate(6464.3,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mn" transform="translate(640,-150) scale(0.707)" data-latex="1"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7507.9,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(7896.9,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="\ldots" transform="translate(8341.6,0)"><path data-c="2026" d="M751 53C751 83 725 106 695 106C664 106 638 83 638 53C638 23 664 0 695 0C725 0 751 23 751 53M475 53C475 83 449 106 419 106C388 106 363 83 363 53C363 23 388 0 419 0C449 0 475 23 475 53M200 53C200 83 174 106 143 106C113 106 87 83 87 53C87 23 113 0 143 0C173 0 200 23 200 53Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(9345.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(9789.9,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_n" transform="translate(10178.9,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(11293.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="\mathbf{x}_n" transform="translate(11737.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbf{x}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="x"><path data-c="1D431" d="M585 0L585 47L514 47L346 246L463 376C476 390 482 397 565 397L565 444L473 441L370 444L370 397C384 397 396 395 408 388C404 382 404 380 400 376L316 282L218 397L258 397L258 444L137 441L27 444L27 397L98 397L254 213L123 66C106 47 70 47 22 47L22 0L114 3L217 0L217 47C199 47 180 52 180 58C180 58 180 60 187 68L284 177L394 47L355 47L355 0L475 3Z"/></g></g><g data-mml-node="mi" transform="translate(640,-150) scale(0.707)" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12852.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(13241.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="\in" transform="translate(13907.9,0)"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^d" transform="translate(14852.6,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="mi" transform="translate(755,413) scale(0.707)" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></svg></mjx-container></span></p>
<p>在处理词元序列时，RNN是逐个的重复地处理词元的，而自注意力是每个词元都直接连接到任何其他词元，它为了并行计算而放弃了顺序操作（训练可以并行但推理仍需要顺序输出）。</p>
<p>因此，自注意力有个问题，其本身完全不感知位置和顺序（因为只是把输入序列各行打乱重排，输出也会对应同样打乱，算子数学本身不携带时序和位置信息），所以必须人为额外把顺序信息塞进去，这就是<strong>位置编码</strong>。</p>
<p>本节介绍transformer论文使用的<strong>三角位置编码</strong>。它是一组经过三角函数调制出来的位置特征向量，交给神经网络去解读。</p>
<p>假设输入表示<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 869 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.995ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3091.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} \in \mathbb{R}^{n \times d}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{n\times d}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n\times d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(600,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1378,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></g></svg></mjx-container></span>包含一个序列中<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.357ex" height="1.025ex" role="img" focusable="false" viewBox="0 -442 600 453"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="n"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g></g></g></svg></mjx-container></span>个词元的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="1.176ex" height="1.595ex" role="img" focusable="false" viewBox="0 -694 520 705"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="d"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></svg></mjx-container></span>维嵌入表示。位置编码使用相同形状的位置嵌入矩阵<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.778ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 786 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{P} \in \mathbb{R}^{n \times d}"><g data-mml-node="TeXAtom" data-latex="\mathbf{P}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="P"><path data-c="1D40F" d="M721 491C721 601 622 686 456 686L39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 302L466 302C605 302 721 374 721 491M568 491C568 420 568 343 417 343L283 343L283 639L418 639C568 639 568 563 568 491Z"/></g></g></g></g></svg><mjx-break size="4"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="6.995ex" height="2.497ex" role="img" focusable="false" viewBox="0 -853.7 3091.9 1103.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{P} \in \mathbb{R}^{n \times d}"><g data-mml-node="mo" data-latex="\in"><path data-c="2208" d="M563 4L373 4C310 4 254 25 208 68C162 111 136 163 130 226L563 226C579 226 587 234 587 250C587 266 579 274 563 274L130 274C136 337 162 389 208 432C254 475 310 496 373 496L563 496C579 496 587 504 587 519C587 535 579 543 563 543L373 543C292 543 223 515 166 458C109 401 81 332 81 250C81 168 109 99 166 42C223-15 292-43 373-43L563-43C579-43 587-35 587-19C587-7 576 4 563 4Z"/></g><g data-mml-node="msup" data-latex="\mathbb{R}^{n\times d}" transform="translate(944.8,0)"><g data-mml-node="TeXAtom" data-latex="\mathbb{R}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="R"><path data-c="211D" d="M104 590L104 95C104 45 99 43 47 43C26 43 16 36 16 22C16 4 31 0 54 0L324 0C349 0 361 7 361 22C361 36 350 43 329 43C277 43 273 45 273 95L273 310L302 310L450 83C475 43 490 20 494 14C500 5 512 0 530 0L666 0C691 0 703 7 703 22C703 33 697 40 685 42C660 47 625 82 579 146C534 208 494 267 459 322C573 344 630 402 630 496C630 563 600 613 540 644C488 671 429 685 364 685L54 685C29 685 16 678 16 663C16 649 26 642 47 642C99 642 104 640 104 590M535 597C570 576 587 542 587 496C587 427 547 385 468 368C485 396 494 438 494 495C494 552 483 596 462 629C487 622 512 612 535 597M452 495C452 433 441 394 419 378C397 362 348 353 273 353L273 593C273 630 287 642 330 642C425 642 452 595 452 495M413 316C496 184 561 93 610 43L525 43L352 311C357 312 361 312 364 312C378 312 394 313 413 316M140 642L240 642C234 631 231 616 231 596L231 93C231 72 233 55 237 43L140 43C144 55 146 72 146 93L146 592C146 613 144 630 140 642Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(755,363) scale(0.707)" data-latex="{n\times d}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mo" data-latex="\times" transform="translate(600,0)"><path data-c="D7" d="M630 32C630 39 628 44 623 49L422 250L623 451C628 456 630 461 630 468C630 481 620 491 607 491C600 491 595 489 590 484L389 283L188 484C183 489 178 491 171 491C158 491 148 481 148 468C148 461 150 456 155 451L356 250L155 49C150 44 148 39 148 32C148 19 158 9 171 9C178 9 183 11 188 16L389 217L590 16C595 11 600 9 607 9C620 9 630 19 630 32Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1378,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g></g></g></svg></mjx-container></span>输出<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="1.966ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 869 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} + \mathbf{P}"><g data-mml-node="TeXAtom" data-latex="\mathbf{X}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="X"><path data-c="1D417" d="M835 0L835 47L737 47L484 397L652 618C663 632 664 633 699 636C723 639 729 639 757 639L786 639L786 686C744 683 695 683 652 683C613 683 536 683 500 686L500 639C518 639 557 639 592 628C591 626 586 620 584 617L452 442L309 639L392 639L392 686C351 683 256 683 211 683C171 683 84 683 49 686L49 639L147 639L369 332L167 67C158 55 156 53 124 50C104 48 83 47 63 47L34 47L34 0C76 3 125 3 168 3C207 3 284 3 320 0L320 47C302 47 263 47 228 58C229 60 234 66 236 69L401 288L575 47L492 47L492 0C533 3 628 3 673 3C713 3 800 3 835 0Z"/></g></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="4.041ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1786.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf{X} + \mathbf{P}"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="TeXAtom" data-latex="\mathbf{P}" data-mjx-texclass="ORD" transform="translate(1000.2,0)"><g data-mml-node="mi" data-latex="P"><path data-c="1D40F" d="M721 491C721 601 622 686 456 686L39 686L39 639L147 639L147 47L39 47L39 0C77 3 175 3 218 3C261 3 359 3 397 0L397 47L289 47L289 302L466 302C605 302 721 374 721 491M568 491C568 420 568 343 417 343L283 343L283 639L418 639C568 639 568 563 568 491Z"/></g></g></g></g></svg></mjx-container></span>，矩阵第<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.025ex;" xmlns="http://www.w3.org/2000/svg" width="0.781ex" height="1.52ex" role="img" focusable="false" viewBox="0 -661 345 672"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="i"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g></g></svg></mjx-container></span>行、第<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.464ex;" xmlns="http://www.w3.org/2000/svg" width="2.063ex" height="1.971ex" role="img" focusable="false" viewBox="0 -666 912 871"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2j"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(500,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></svg></mjx-container></span>列和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="2.063ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 912 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2j+1"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(500,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></svg><mjx-break size="3"> </mjx-break><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="3.394ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 1500.2 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="2j+1"><g data-mml-node="mo" data-latex="+"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(1000.2,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></svg></mjx-container></span>列上的元素为：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -4.847ex;" xmlns="http://www.w3.org/2000/svg" width="25.177ex" height="10.825ex" role="img" focusable="false" viewBox="0 -2642.4 11128.4 4784.8"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{aligned}
p_{i, 2j} &amp;= \sin\left(\frac{i}{10000^{2j/d}}\right)\\
p_{i, 2j+1} &amp;= \cos\left(\frac{i}{10000^{2j/d}}\right)
\end{aligned}"><g data-mml-node="mtable" data-latex="\begin{aligned}
p_{i, 2j} &amp;= \sin\left(\frac{i}{10000^{2j/d}}\right)\\
p_{i, 2j+1} &amp;= \cos\left(\frac{i}{10000^{2j/d}}\right)
\end{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,1305.4)"><g data-mml-node="mtd" transform="translate(903.7,0)"><g data-mml-node="msub" data-latex="p_{i,2j}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g><g data-mml-node="mtd" transform="translate(2575.1,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(1333.6,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(2561.6,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left(\frac{i}{10000^{2j/d}}\right)" transform="translate(2728.2,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M588-796C601-796 608-789 608-776C608-770 606-765 601-760C500-684 420-552 361-365C310-206 285-51 285 101L285 399C285 551 310 706 361 865C420 1052 500 1184 601 1260C606 1265 608 1270 608 1276C608 1289 601 1296 588 1296C583 1296 579 1295 576 1292C464 1207 372 1071 300 886C234 717 201 554 201 399L201 101C201-54 234-217 300-386C372-571 464-707 576-792C579-795 583-796 588-796Z"/></g><g data-mml-node="mfrac" data-latex="\frac{i}{10000^{2j/d}}" transform="translate(663,0)"><g data-mml-node="mi" data-latex="i" transform="translate(2022.1,676)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msup" data-latex="10000^{2j/d}" transform="translate(220,-883.4)"><g data-mml-node="mn" data-latex="10000"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1000,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(2000,0)"/></g><g data-mml-node="TeXAtom" transform="translate(2533,393.1) scale(0.707)" data-latex="{2j/d}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(500,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(912,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1412,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g><rect width="4149.1" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(5052.1,0)"><path data-c="29" d="M86-792C198-707 290-571 363-386C429-217 462-54 462 101L462 399C462 554 429 717 363 886C290 1071 198 1207 86 1292C83 1295 80 1296 75 1296C62 1296 55 1289 55 1276C55 1269 57 1264 62 1260C163 1183 243 1052 302 865C353 707 378 552 378 399L378 101C378-51 353-206 302-365C243-552 163-684 62-760C57-764 55-769 55-776C55-789 62-796 75-796C80-796 83-795 86-792Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1237)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="p_{i,2j+1}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1535,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2313,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g><g data-mml-node="mtd" transform="translate(2575.1,0)"><g data-mml-node="mstyle"><g data-mml-node="mi"/><g data-mml-node="mo" data-latex="=" transform="translate(277.8,0)"><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g><g data-mml-node="mi" data-latex="\cos" transform="translate(1333.6,0)"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(2671.6,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left(\frac{i}{10000^{2j/d}}\right)" transform="translate(2838.2,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M588-796C601-796 608-789 608-776C608-770 606-765 601-760C500-684 420-552 361-365C310-206 285-51 285 101L285 399C285 551 310 706 361 865C420 1052 500 1184 601 1260C606 1265 608 1270 608 1276C608 1289 601 1296 588 1296C583 1296 579 1295 576 1292C464 1207 372 1071 300 886C234 717 201 554 201 399L201 101C201-54 234-217 300-386C372-571 464-707 576-792C579-795 583-796 588-796Z"/></g><g data-mml-node="mfrac" data-latex="\frac{i}{10000^{2j/d}}" transform="translate(663,0)"><g data-mml-node="mi" data-latex="i" transform="translate(2022.1,676)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msup" data-latex="10000^{2j/d}" transform="translate(220,-883.4)"><g data-mml-node="mn" data-latex="10000"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1000,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(1500,0)"/><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z" transform="translate(2000,0)"/></g><g data-mml-node="TeXAtom" transform="translate(2533,393.1) scale(0.707)" data-latex="{2j/d}" data-mjx-texclass="ORD"><g data-mml-node="mn" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(500,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(912,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(1412,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g></g><rect width="4149.1" height="60" x="120" y="220"/></g><g data-mml-node="mo" data-latex="\right)" transform="translate(5052.1,0)"><path data-c="29" d="M86-792C198-707 290-571 363-386C429-217 462-54 462 101L462 399C462 554 429 717 363 886C290 1071 198 1207 86 1292C83 1295 80 1296 75 1296C62 1296 55 1289 55 1276C55 1269 57 1264 62 1260C163 1183 243 1052 302 865C353 707 378 552 378 399L378 101C378-51 353-206 302-365C243-552 163-684 62-760C57-764 55-769 55-776C55-789 62-796 75-796C80-796 83-795 86-792Z"/></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>简单来说就是：序列中每个位置的词元都用一个向量来表达位置，该向量的长度与词元本身的嵌入向量一样大，这样我们就可以将输入矩阵与位置矩阵直接相加，以将位置信息融合到输入中去。</p>
<p>很显然，最朴素的编码位置的想法是：使用二进制向量来表达位置信息，假设序列中有1024个词元，那就可以用长度为10的向量来表达位置。但是这样编码的坏处是需要随最大序列改变维度，同时很难表达相对位置的概念。</p>
<p>三角位置编码，在编码向量（横向）使用多个不同频率的三角函数，不同序列间（纵向）是对应三角函数值。编码向量中的低维元素值随着序列词元下标增加的变化较快，高位元素值随着序列词元下标增加的变化较慢，从而实现<strong>通过不同频率模式类比二进制比特</strong>，即：位置编码向量里，一部分维度对微小位置变化敏感（高频，分辨相邻token）；另一部分维度对远距离变化敏感（低频，分辨相距很远的token）。</p>
<p>此外，三角函数编码还具备表达相对位置偏移的能力。位置向量使用的不同频率的三角函数中，每个频率使用的是一对sin和cos表达。通过三角函数的和角公式，可以证明任何一对<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="12.374ex" height="2.36ex" role="img" focusable="false" viewBox="0 -748 5469.2 1043"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="(p_{i, 2j}, p_{i, 2j+1})"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="p_{i,2j}" transform="translate(389,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2060.4,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="p_{i,2j+1}" transform="translate(2505.1,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1535,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2313,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(5080.2,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>可以通过不依赖于任何位置索引的线性变换，变换为<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.667ex;" xmlns="http://www.w3.org/2000/svg" width="16.309ex" height="2.36ex" role="img" focusable="false" viewBox="0 -748 7208.6 1043"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="(p_{i+\delta, 2j}, p_{i+\delta, 2j+1})"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msub" data-latex="p_{i+\delta,2j}" transform="translate(389,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i+\delta,2j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1123,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1575,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1853,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(2353,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g><g data-mml-node="mo" data-latex="," transform="translate(2930.2,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="msub" data-latex="p_{i+\delta,2j+1}" transform="translate(3374.8,0)"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i+\delta,2j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1123,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1575,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1853,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(2353,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(2765,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(3543,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6819.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>：</p>
<p><span class="firekylin-markdown-mathjax-block"><mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg style="vertical-align: -11.719ex;" xmlns="http://www.w3.org/2000/svg" width="41.081ex" height="24.569ex" role="img" focusable="false" viewBox="0 -5679.8 18157.8 10859.7"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\begin{split}\begin{aligned}
&amp;\begin{bmatrix} \cos(\delta \omega_j) &amp; \sin(\delta \omega_j) \\  -\sin(\delta \omega_j) &amp; \cos(\delta \omega_j) \\ \end{bmatrix}
\begin{bmatrix} p_{i, 2j} \\  p_{i, 2j+1} \\ \end{bmatrix}\\
=&amp;\begin{bmatrix} \cos(\delta \omega_j) \sin(i \omega_j) + \sin(\delta \omega_j) \cos(i \omega_j) \\  -\sin(\delta \omega_j) \sin(i \omega_j) + \cos(\delta \omega_j) \cos(i \omega_j) \\ \end{bmatrix}\\
=&amp;\begin{bmatrix} \sin\left((i+\delta) \omega_j\right) \\  \cos\left((i+\delta) \omega_j\right) \\ \end{bmatrix}\\
=&amp;
\begin{bmatrix} p_{i+\delta, 2j} \\  p_{i+\delta, 2j+1} \\ \end{bmatrix},
\end{aligned}\end{split}"><g data-mml-node="mtable" data-latex="\begin{split}\begin{aligned}
&amp;\begin{bmatrix} \cos(\delta \omega_j) &amp; \sin(\delta \omega_j) \\  -\sin(\delta \omega_j) &amp; \cos(\delta \omega_j) \\ \end{bmatrix}
\begin{bmatrix} p_{i, 2j} \\  p_{i, 2j+1} \\ \end{bmatrix}\\
=&amp;\begin{bmatrix} \cos(\delta \omega_j) \sin(i \omega_j) + \sin(\delta \omega_j) \cos(i \omega_j) \\  -\sin(\delta \omega_j) \sin(i \omega_j) + \cos(\delta \omega_j) \cos(i \omega_j) \\ \end{bmatrix}\\
=&amp;\begin{bmatrix} \sin\left((i+\delta) \omega_j\right) \\  \cos\left((i+\delta) \omega_j\right) \\ \end{bmatrix}\\
=&amp;
\begin{bmatrix} p_{i+\delta, 2j} \\  p_{i+\delta, 2j+1} \\ \end{bmatrix},
\end{aligned}\end{split}"><g data-mml-node="mtr"><g data-mml-node="mtd"><g data-mml-node="mtable" data-latex="{aligned}"><g data-mml-node="mtr" data-latex="
" transform="translate(0,4184.9)"><g data-mml-node="mtd" transform="translate(778,0)"/><g data-mml-node="mtd" transform="translate(778,0)"><g data-mml-node="mstyle"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="5B" d="M477-884L297-884L297 1384L477 1384C498 1384 509 1395 509 1417C509 1439 498 1450 477 1450L233 1450L233-950L477-950C498-950 509-939 509-917C509-899 495-884 477-884Z"/></g><g data-mml-node="mtable" transform="translate(528,0)"><g data-mml-node="mtr" transform="translate(0,745)"><g data-mml-node="mtd" transform="translate(417.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1338,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1727,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(2179,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3175.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(5454,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1228,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1617,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(2069,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3065.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(944.7,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(2172.7,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(2172.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(2561.7,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(3013.7,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4010,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mtd" transform="translate(5399,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1338,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1727,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(2179,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3175.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mo" transform="translate(9491.3,0)"><path data-c="5D" d="M51-950L295-950L295 1450L51 1450C30 1450 19 1439 19 1417C19 1395 30 1384 51 1384L231 1384L231-884L51-884C30-884 19-895 19-917C19-939 30-950 51-950Z"/></g></g><g data-mml-node="mrow" data-latex="{bmatrix}" transform="translate(10186,0)"><g data-mml-node="mo"><path data-c="5B" d="M477-884L297-884L297 1384L477 1384C498 1384 509 1395 509 1417C509 1439 498 1450 477 1450L233 1450L233-950L477-950C498-950 509-939 509-917C509-899 495-884 477-884Z"/></g><g data-mml-node="mtable" transform="translate(528,0)"><g data-mml-node="mtr" transform="translate(0,745)"><g data-mml-node="mtd" transform="translate(451.8,0)"><g data-mml-node="msub" data-latex="p_{i,2j}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="p_{i,2j+1}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i,2j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(345,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(623,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(1123,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1535,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2313,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(3103.1,0)"><path data-c="5D" d="M51-950L295-950L295 1450L51 1450C30 1450 19 1439 19 1417C19 1395 30 1384 51 1384L231 1384L231-884L51-884C30-884 19-895 19-917C19-939 30-950 51-950Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,1395)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="mtd" transform="translate(778,0)"><g data-mml-node="mstyle"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="5B" d="M477-884L297-884L297 1384L477 1384C498 1384 509 1395 509 1417C509 1439 498 1450 477 1450L233 1450L233-950L477-950C498-950 509-939 509-917C509-899 495-884 477-884Z"/></g><g data-mml-node="mtable" transform="translate(528,0)"><g data-mml-node="mtr" transform="translate(0,745)"><g data-mml-node="mtd" transform="translate(472.3,0)"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(1338,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1727,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(2179,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(3175.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(3731,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(4959,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(4959,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(5348,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(5693,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(6689.3,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(7300.5,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(8300.8,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(9528.8,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(9528.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(9917.8,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(10369.8,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(11366.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="\cos" transform="translate(11921.8,0)"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(13259.8,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(13259.8,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(13648.8,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(13993.8,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(14990.1,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="-"><path data-c="2212" d="M698 270L80 270C64 270 56 263 56 250C56 237 64 230 80 230L698 230C714 230 722 237 722 250C722 262 710 270 698 270Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(944.7,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(2172.7,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(2172.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(2561.7,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(3013.7,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(4010,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="\sin" transform="translate(4565.7,0)"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(5793.7,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(5793.7,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(6182.7,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(6527.7,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(7524,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(8135.2,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\cos" transform="translate(9135.4,0)"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(10473.4,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(10473.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(10862.4,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(11314.4,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(12310.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="mi" data-latex="\cos" transform="translate(12866.4,0)"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(14204.4,0)"><path data-c="2061" d=""/></g><g data-mml-node="mo" data-latex="(" transform="translate(14204.4,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(14593.4,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(14938.4,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(15934.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mo" transform="translate(16851.8,0)"><path data-c="5D" d="M51-950L295-950L295 1450L51 1450C30 1450 19 1439 19 1417C19 1395 30 1384 51 1384L231 1384L231-884L51-884C30-884 19-895 19-917C19-939 30-950 51-950Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-1395)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="mtd" transform="translate(778,0)"><g data-mml-node="mstyle"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="5B" d="M477-884L297-884L297 1384L477 1384C498 1384 509 1395 509 1417C509 1439 498 1450 477 1450L233 1450L233-950L477-950C498-950 509-939 509-917C509-899 495-884 477-884Z"/></g><g data-mml-node="mtable" transform="translate(528,0)"><g data-mml-node="mtr" transform="translate(0,745)"><g data-mml-node="mtd" transform="translate(55,0)"><g data-mml-node="mi" data-latex="\sin"><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z"/><path data-c="69" d="M194 601C194 631 169 657 139 657C109 657 83 631 83 601C83 571 108 544 138 544C169 544 194 570 194 601M143 3L247 0L247 39C214 39 194 41 188 45C182 49 180 60 180 78L180 445L37 433L37 395C70 395 91 392 98 387C105 382 108 368 108 345L108 79C108 60 105 48 98 44C91 40 69 39 33 39L33 0Z" transform="translate(394,0)"/><path data-c="6E" d="M314 413C359 413 382 378 382 307L382 79C382 60 379 48 372 44C365 40 343 38 306 38L306 0L421 3L535 0L535 38C503 38 482 39 472 42C462 45 458 52 458 64L458 251C458 298 457 331 454 350C444 411 399 442 320 442C257 442 210 412 179 352L179 442L32 431L32 393C68 393 90 390 98 384C106 378 109 365 109 342L109 79C109 60 105 48 98 44C91 40 69 38 32 38L32 0L147 3L261 0L261 38C224 38 203 40 196 44C189 48 185 60 185 79L185 259C185 340 236 413 314 413Z" transform="translate(672,0)"/></g><g data-mml-node="mo" transform="translate(1228,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left((i+\delta) \omega_j\right)" transform="translate(1394.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(389,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(778,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1345.2,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(2345.4,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2797.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(3186.4,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(4182.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd"><g data-mml-node="mi" data-latex="\cos"><path data-c="63" d="M251 416C293 416 325 406 347 386C323 383 306 361 306 338C306 305 322 289 355 289C388 289 404 306 404 339C404 410 327 448 250 448C188 448 137 426 96 380C55 334 34 279 34 216C34 155 55 101 96 56C137 11 187-11 248-11C298-11 337 3 365 32C388 55 403 78 411 102C414 111 415 117 415 121C415 130 409 134 398 134C390 134 385 130 382 122C361 55 320 21 257 21C228 21 200 34 172 61C139 92 123 144 123 218C123 318 161 416 251 416Z"/><path data-c="6F" d="M249-11C311-11 363 11 406 55C449 99 471 152 471 214C471 277 450 332 408 378C366 424 313 448 250 448C187 448 135 424 92 378C49 332 28 277 28 214C28 152 49 99 92 55C135 11 188-11 249-11M250 21C202 21 166 42 141 85C125 113 117 159 117 222C117 283 125 327 140 355C164 398 200 419 249 419C296 419 332 398 357 357C374 329 382 284 382 222C382 106 348 21 250 21Z" transform="translate(444,0)"/><path data-c="73" d="M360 130C360 206 308 254 205 274C158 283 128 294 112 305C96 316 88 332 88 351C88 398 123 421 193 421C261 421 298 383 303 306C304 298 309 294 319 294C330 294 336 303 336 321L336 420C336 439 331 448 321 448C310 448 295 430 285 422C260 439 229 448 193 448C104 448 33 408 33 323C33 289 47 260 76 237C111 208 144 202 207 191C272 178 305 149 305 104C305 47 270 18 199 18C130 18 86 64 67 155C64 168 59 175 50 175C39 175 33 165 33 146L33 17C33-2 38-11 48-11C51-11 56-8 64-1C82 15 74 12 92 30C121 3 157-11 199-11C294-11 360 38 360 130Z" transform="translate(944,0)"/></g><g data-mml-node="mo" transform="translate(1338,0)"><path data-c="2061" d=""/></g><g data-mml-node="mrow" data-latex="\left((i+\delta) \omega_j\right)" transform="translate(1504.7,0)"><g data-mml-node="mo" data-latex="\left("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mo" data-latex="(" transform="translate(389,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="i" transform="translate(778,0)"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(1345.2,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(2345.4,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2797.4,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g><g data-mml-node="msub" data-latex="\omega_j" transform="translate(3186.4,0)"><g data-mml-node="mi" data-latex="\omega"><path data-c="1D714" d="M505 391C505 380 509 370 517 363C542 342 554 314 554 280C554 267 553 255 550 244C530 168 477 68 396 68C344 68 313 96 303 152C316 179 326 207 333 238C336 249 337 258 337 264C337 284 329 294 314 294C276 294 266 198 264 156C227 97 184 68 133 68C78 68 51 104 51 175C51 195 54 216 59 238C70 282 99 337 146 402C150 407 152 412 152 417C152 430 145 437 130 437C123 437 116 434 110 427C61 360 13 242 13 133C13 37 49-11 121-11C178-11 227 22 270 87C284 22 322-11 383-11C416-11 447 2 475 28C522 72 557 142 581 238C596 299 604 342 604 369C604 398 597 419 583 432C576 439 567 442 558 442C532 442 505 417 505 391Z"/></g><g data-mml-node="mi" transform="translate(655,-150) scale(0.707)" data-latex="j"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g><g data-mml-node="mo" data-latex="\right)" transform="translate(4182.8,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></g></g><g data-mml-node="mo" transform="translate(6604.4,0)"><path data-c="5D" d="M51-950L295-950L295 1450L51 1450C30 1450 19 1439 19 1417C19 1395 30 1384 51 1384L231 1384L231-884L51-884C30-884 19-895 19-917C19-939 30-950 51-950Z"/></g></g></g></g></g><g data-mml-node="mtr" data-latex="
" transform="translate(0,-4184.9)"><g data-mml-node="mtd"><g data-mml-node="mo" data-latex="="><path data-c="3D" d="M698 367L80 367C64 367 56 359 56 344C56 329 64 321 80 321L698 321C714 321 722 329 722 344C722 356 711 367 698 367M698 179L80 179C64 179 56 171 56 156C56 141 64 133 80 133L698 133C714 133 722 141 722 156C722 169 711 179 698 179Z"/></g></g><g data-mml-node="mtd" transform="translate(778,0)"><g data-mml-node="mstyle"><g data-mml-node="mrow" data-latex="{bmatrix}"><g data-mml-node="mo"><path data-c="5B" d="M477-884L297-884L297 1384L477 1384C498 1384 509 1395 509 1417C509 1439 498 1450 477 1450L233 1450L233-950L477-950C498-950 509-939 509-917C509-899 495-884 477-884Z"/></g><g data-mml-node="mtable" transform="translate(528,0)"><g data-mml-node="mtr" transform="translate(0,745)"><g data-mml-node="mtd" transform="translate(451.8,0)"><g data-mml-node="msub" data-latex="p_{i+\delta,2j}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i+\delta,2j}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1123,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1575,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1853,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(2353,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g></g></g></g></g><g data-mml-node="mtr" transform="translate(0,-700)"><g data-mml-node="mtd"><g data-mml-node="msub" data-latex="p_{i+\delta,2j+1}"><g data-mml-node="mi" data-latex="p"><path data-c="1D45D" d="M355 442C311 442 269 419 228 373C217 419 186 442 137 442C96 442 66 409 45 344C35 311 30 292 30 286C30 277 35 272 46 272C51 272 54 273 57 275C62 284 65 291 66 298C84 374 107 412 134 412C152 412 161 398 161 371C161 356 159 339 154 321L44-118C35-151 34-155-5-155C-23-155-32-163-32-178C-32-189-26-194-15-194C0-194 52-191 67-191C86-191 146-194 165-194C180-194 187-186 187-170C187-160 178-155 159-155C141-155 114-156 114-144C114-131 155 26 159 43C179 6 209-13 249-13C314-13 371 20 421 87C467 148 490 213 490 280C490 367 438 442 355 442M352 412C391 412 411 382 411 323C411 296 405 260 394 215C371 128 342 71 307 42C286 25 267 16 248 16C219 16 199 29 188 56C179 77 174 92 174 100L225 309C230 331 248 354 276 377C304 400 329 412 352 412Z"/></g><g data-mml-node="TeXAtom" transform="translate(536,-150) scale(0.707)" data-latex="{i+\delta,2j+1}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(345,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mi" data-latex="\delta" transform="translate(1123,0)"><path data-c="1D6FF" d="M452 664C452 679 444 689 428 693C377 706 339 712 315 712C244 712 201 672 201 606C201 567 220 511 259 438C156 412 76 321 51 220C46 199 43 178 43 159C43 121 52 87 71 58C101 12 145-11 202-11C244-11 282 8 317 47C372 110 400 190 400 285C400 346 380 402 339 453L332 462C267 546 235 602 235 630C235 636 236 641 239 645C249 663 265 672 288 671C305 671 326 663 351 648C382 629 401 620 408 620C430 620 452 638 452 664M111 131C111 188 125 243 154 297C185 357 225 395 274 410C296 372 311 333 320 294C323 279 324 262 324 245C324 217 321 191 315 166C290 68 252 19 203 19C146 19 111 66 111 131Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1575,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="2" transform="translate(1853,0)"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g><g data-mml-node="mi" data-latex="j" transform="translate(2353,0)"><path data-c="1D457" d="M397 621C397 648 383 661 356 661C328 661 300 633 300 605C300 578 313 565 340 565C368 565 397 593 397 621M267 444C214 444 169 404 147 369C120 326 107 299 107 287C107 278 112 274 122 274C127 274 130 275 133 276C138 284 141 291 144 296C176 375 216 414 264 414C282 414 291 400 291 373C291 358 289 341 284 323L192-46C178-104 138-175 75-175C66-175 57-174 48-171C73-161 85-143 85-118C85-92 71-79 44-79C12-79-13-108-13-140C-13-184 30-205 77-205C120-205 160-190 197-160C232-131 254-94 265-51L356 311C359 324 361 337 361 349C361 404 322 444 267 444Z"/></g><g data-mml-node="mo" data-latex="+" transform="translate(2765,0)"><path data-c="2B" d="M698 274L413 274L413 559C413 575 405 583 389 583C373 583 365 575 365 559L365 274L80 274C64 274 56 266 56 250C56 234 64 226 80 226L365 226L365-59C365-75 373-83 389-83C405-83 413-75 413-59L413 226L698 226C714 226 722 234 722 250C722 263 711 274 698 274Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(3543,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g></g></g></g></g></g><g data-mml-node="mo" transform="translate(3972.8,0)"><path data-c="5D" d="M51-950L295-950L295 1450L51 1450C30 1450 19 1439 19 1417C19 1395 30 1384 51 1384L231 1384L231-884L51-884C30-884 19-895 19-917C19-939 30-950 51-950Z"/></g></g><g data-mml-node="mo" data-latex="," transform="translate(4667.5,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g></g></g></g></g></g></g></g></g></g></svg></mjx-container></span></p>
<p>由于神经网络有能力去学到这个变换，从而这种编码能够利用相对位置。</p>
<h2><a id="toc-29c" class="anchor" href="#toc-29c"></a>Transformer（The Transformer Architecture）</h2><p>本节仍以机器翻译为例，介绍编码器-解码器架构下的Transformer架构。</p>
<p>它关键的创新在于：用自注意力完全替代了循环结构，使得整个序列的所有位置可以同时计算。一个1024长度的序列，在RNN里要算1024步，在Transformer里自注意力一次矩阵乘法就搞定了。这才是它能scale up到现在这个规模的根本原因。Transformer的革命性不在于注意力机制本身有多神奇，而在于它证明了不用循环结构也能处理序列，而且效果更好。</p>
<div class="markdown-alert markdown-alert-important">
<p class="markdown-alert-title"><svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>本节教材中有两处关键错误：</p>
<ol>
<li>编码器和解码器在计算嵌入向量后，进行了<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.206ex;" xmlns="http://www.w3.org/2000/svg" width="3.106ex" height="2.398ex" role="img" focusable="false" viewBox="0 -969 1373 1060"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\sqrt{d}"><g data-mml-node="msqrt" data-latex="\sqrt{d}"><g data-mml-node="mo" transform="translate(0,869)"><path data-c="221A" d="M847-2C851 7 853 13 853 16C853 32 845 40 829 40C820 40 813 36 809 27C666-259 595-403 595-405L595-406C595-413 527-558 390-843L217-461C212-450 207-445 201-445C198-445 192-448 184-454L86-528C77-535 73-540 73-545C73-555 78-560 87-560C90-560 95-557 103-551L151-516L345-943C350-954 357-960 367-960C379-960 387-955 392-946Z"/></g><g transform="translate(853,0)"><g data-mml-node="mi" data-latex="d"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g></g><rect width="520" height="60" x="853" y="849"/></g></g></g></svg></mjx-container></span>的缩放操作，Transformer原文也是这么做的，目的是让嵌入向量与位置编码的大小匹配。但是nn.Embedding初始化已经是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="7.307ex" height="2.253ex" role="img" focusable="false" viewBox="0 -748 3229.7 996"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{N}(0,1)"><g data-mml-node="TeXAtom" data-latex="\mathcal{N}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="N"><path data-c="4E" d="M41 49C41 16 71-4 104-4C197-4 274 94 309 169C328 211 352 280 379 377L420 523C485 404 548 227 609-9L671 24L773 438C788 501 797 537 800 546C816 599 832 633 848 646C853 650 859 652 868 652C875 652 880 647 880 638C881 620 888 609 913 609L950 625C957 630 963 639 966 652C973 685 952 706 920 706C859 706 813 671 781 602C760 557 745 516 737 479L661 140L656 134L527 491C505 551 480 600 452 637C420 680 384 701 345 701C304 701 268 689 237 665C200 636 174 589 159 525L190 531C208 572 226 601 245 616C261 629 280 636 303 636C330 636 357 617 386 579L322 324C306 261 289 211 272 175C254 135 236 108 217 93C195 75 174 66 154 66C138 66 132 79 126 93C123 104 111 109 97 109C71 109 41 74 41 49Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1007,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="0" transform="translate(1396,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1896,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2340.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(2840.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，而非原实现的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.566ex;" xmlns="http://www.w3.org/2000/svg" width="9.615ex" height="2.262ex" role="img" focusable="false" viewBox="0 -750 4249.7 1000"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{N}(0,1/d)"><g data-mml-node="TeXAtom" data-latex="\mathcal{N}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="N"><path data-c="4E" d="M41 49C41 16 71-4 104-4C197-4 274 94 309 169C328 211 352 280 379 377L420 523C485 404 548 227 609-9L671 24L773 438C788 501 797 537 800 546C816 599 832 633 848 646C853 650 859 652 868 652C875 652 880 647 880 638C881 620 888 609 913 609L950 625C957 630 963 639 966 652C973 685 952 706 920 706C859 706 813 671 781 602C760 557 745 516 737 479L661 140L656 134L527 491C505 551 480 600 452 637C420 680 384 701 345 701C304 701 268 689 237 665C200 636 174 589 159 525L190 531C208 572 226 601 245 616C261 629 280 636 303 636C330 636 357 617 386 579L322 324C306 261 289 211 272 175C254 135 236 108 217 93C195 75 174 66 154 66C138 66 132 79 126 93C123 104 111 109 97 109C71 109 41 74 41 49Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(1007,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mn" data-latex="0" transform="translate(1396,0)"><path data-c="30" d="M249-22C390-22 460 92 460 320C460 473 428 575 365 625C330 652 291 666 250 666C109 666 39 551 39 320C39 136 88-22 249-22M361 524C368 489 371 425 371 332C371 240 367 172 360 128C347 48 310 8 249 8C226 8 203 17 182 34C155 57 139 104 132 176C129 201 128 253 128 332C128 419 131 480 136 513C145 568 163 603 191 618C213 630 232 636 249 636C314 636 350 583 361 524Z"/></g><g data-mml-node="mo" data-latex="," transform="translate(1896,0)"><path data-c="2C" d="M139 106C107 106 86 82 86 50C86 20 109-5 139-5C153-5 165-1 174 8L175 0C175-63 154-117 112-160C105-168 101-174 101-178C101-188 105-193 114-193C123-193 135-181 152-158C186-110 203-57 203 0C203 53 185 106 139 106Z"/></g><g data-mml-node="mn" data-latex="1" transform="translate(2340.7,0)"><path data-c="31" d="M269 666C228 624 168 603 89 603L89 564C141 564 184 572 217 588L217 82C217 64 213 52 204 47C195 42 170 39 130 39L95 39L95 0C120 2 174 3 257 3C340 3 394 2 419 0L419 39L384 39C343 39 318 42 310 47C302 52 297 64 297 82L297 636C297 660 295 666 269 666Z"/></g><g data-mml-node="mo" data-latex="/" transform="translate(2840.7,0)"><path data-c="2F" d="M444 718C445 720 445 723 445 726C445 742 437 750 421 750C410 750 403 745 399 734L57-218C56-220 56-223 56-226C56-242 64-250 80-250C91-250 98-245 102-234Z"/></g><g data-mml-node="mi" data-latex="d" transform="translate(3340.7,0)"><path data-c="1D451" d="M429 632L370 389C349 426 320 445 281 445C216 445 159 412 109 345C63 283 40 218 40 151C40 63 91-11 175-11C218-11 260 12 300 59C311 21 345-11 392-11C461-11 483 71 498 145C498 154 493 159 483 159C474 159 468 152 465 138C445 59 421 19 394 19C377 19 368 33 368 60C368 75 370 91 374 107L516 679L516 683C513 690 507 694 499 694C476 694 434 690 374 683C363 682 357 674 357 660C357 650 366 645 384 645C403 645 429 646 429 632M341 376C351 355 356 341 356 332C355 328 354 323 353 316L304 122C301 111 294 99 285 87C248 42 212 19 177 19C138 19 118 49 118 108C118 132 124 168 136 216C157 301 187 359 224 390C244 407 263 415 282 415C309 415 329 402 341 376Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(3860.7,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>，方差与位置向量的量级是匹配的，所以不需要额外做缩放。</li>
<li>预测模式下，<code>d2l.predict_seq2seq()</code>函数将输入词元一个一个单独传入TransformerDecoder进行预测，使得TransformerDecoder内部是获取不到每个词元在序列中的位置的，所以其内部调用<code>d2l.PositionalEncoding</code>（试图根据词元下标来计算位置编码）计算出的位置编码永远都是第一个位置的编码。参考评论区的解决方案：让<code>predict_seq2seq()</code>将词元的位置信息也传入Decoder，以交给<code>d2l.PositionalEncoding</code>内部正确处理：<ul>
<li><code>d2l.predict_seq2seq()</code>调用decoder解码时添加offset参数<pre><code class="hljs lang-python"><span class="hljs-comment"># 原代码</span>
<span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_steps):
    Y, dec_state = net.decoder(dec_X, dec_state)
<span class="hljs-comment"># 新代码</span>
<span class="hljs-keyword">for</span> idx <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_steps):
    Y, dec_state = net.decoder(dec_X, dec_state, offset=idx)
</code></pre></li>
<li><code>TransformerDecoder.forward()</code>，将offset透传给<code>d2l.PositionalEncoding</code><pre><code class="hljs lang-python"><span class="hljs-comment"># 原代码</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X, state</span>):
    X = <span class="hljs-variable language_">self</span>.pos_encoding(<span class="hljs-variable language_">self</span>.embedding(X) * math.sqrt(<span class="hljs-variable language_">self</span>.num_hiddens)) <span class="hljs-comment"># 结合上面第一个问题，其实这里不需要缩放</span>
<span class="hljs-comment"># 新代码</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X, state, offset=<span class="hljs-number">0</span></span>):
    X = <span class="hljs-variable language_">self</span>.pos_encoding(<span class="hljs-variable language_">self</span>.embedding(X) * math.sqrt(<span class="hljs-variable language_">self</span>.num_hiddens), offset)
</code></pre></li>
<li><code>d2l.PositionalEncoding.forward()</code>，利用传入的offset计算出位置编码<pre><code class="hljs lang-python"><span class="hljs-comment"># 原代码</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X</span>):
    X = X + <span class="hljs-variable language_">self</span>.P[:, :X.shape[<span class="hljs-number">1</span>], :].to(X.device)
<span class="hljs-comment"># 新代码</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, X, offset=<span class="hljs-number">0</span></span>):
    X = X + <span class="hljs-variable language_">self</span>.P[:, offset:offset+X.shape[<span class="hljs-number">1</span>], :].to(X.device)
</code></pre></li>
</ul>
</li>
</ol>
</div>
<p class="firekylin-markdown-img-only"><img src="/static/upload/20260817/transformer.svg" alt="transformer.svg"></p>
<p>编码器与解码器的结构略有不同：</p>
<ul>
<li>编码器：原文（小批量、多个时间步）经过嵌入层并加上位置编码后，连续进行多个block的计算<ul>
<li>每个block的计算步骤为：<ul>
<li>[<code>编码器多头自注意力</code>-&gt;<code>残差网络连接</code>-&gt;<code>层规范化</code>] -&gt;</li>
<li>[<code>逐位置前馈网络</code>-&gt;<code>残差网络连接</code>-&gt;<code>层规范化</code>]</li>
</ul>
</li>
</ul>
</li>
<li>解码器：译文（小批量、1个时间步，以<code>&lt;bos&gt;</code>开头）经过嵌入层并加上位置编码后，连续进行多个block的计算，最后经过一个全连接层得到新输出token的softmax概率<ul>
<li>每个block的计算步骤为：<ul>
<li>[<code>解码器掩蔽多头自注意力</code>-&gt;<code>残差网络连接</code>-&gt;<code>层规范化</code>] -&gt;</li>
<li>[<code>编码器-解码器多头注意力</code>-&gt;<code>残差网络连接</code>-&gt;<code>层规范化</code>]-&gt;</li>
<li>[<code>逐位置前馈网络</code>-&gt;<code>残差网络连接</code>-&gt;<code>层规范化</code>]</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>其中还有还有ReLU和Dropout操作，我们这里暂且省略。下面解释下每个计算步骤的含义：</p>
<ul>
<li><code>编码器多头自注意力</code>：对原文中所有时间步的向量之间计算多头自注意力。QKV对第一个block来说就是每个词元加了位置编码的每个嵌入向量，对后面的block来说就是前一个block的输出（这一点对于下面其他类型的自注意力也是一样的，下面不再重复说明）。计算自注意力时对词元为<code>&lt;pad&gt;</code>的时间步所对应的KV加了mask，以避免对<code>&lt;pad&gt;</code>位置的词元产生注意力。</li>
<li><code>残差网络连接</code>：使用ResNet的思想，把上一个节点的输入和输出加起来，作为本节点的输出。</li>
<li><code>层规范化</code>：基于特征维度进行规范化，即每个样本的每个时间步的向量单独做规范化处理。由于不跨样本、不跨时间步计算，即使遇到极长或极短的句子，LayerNorm也能以完全相同的逻辑稳定计算，使其在自然语言处理任务中比批量规范化效果更好。<blockquote>
<p>BatchNorm与LayerNorm的对比如下：<br>BatchNorm是对一个batch_size样本内的每个特征分别做归一化，LayerNorm是分别对每个样本的所有特征做归一化<br>BatchNorm抹杀了不同特征之间的大小关系，但是保留了不同样本间的大小关系；LayerNorm抹杀了不同样本间的大小关系，但是保留了一个样本内不同特征之间的大小关系<br>BatchNorm假设跨样本的同一特征是同分布，这个假设在CV成立，在NLP变长、语义多样的场景不成立；LayerNorm放弃跨样本统计，只做样本内部归一化，可以避开这些问题</p>
</blockquote>
</li>
<li><code>逐位置前馈网络</code>（Position-wise Feed-Forward Network）：本质上就是个多层感知机，只不过无论是哪个位置（时间步），使用的都是相同的一套参数。</li>
<li><code>解码器掩蔽多头自注意力</code>：对译文中所有时间步的向量之间计算多头自注意力。这里之所以叫掩蔽多头自注意力，是因为训练阶段是有完整译文的，但为了保留自回归属性，计算自注意力时对Q之后的词元的时间步所对应的KV加了mask，以避免对其后续位置的词元产生注意力（这是对训练来说，而对于预测，词元是一个个生成的，天然不会对未产生的词元产生注意力，所以不需要掩蔽）。</li>
<li><code>编码器-解码器多头注意力</code>：用当前节点的输入作为Q、编码器对原文各时间步生成的词元向量作为KV计算注意力。</li>
</ul>
<p>这个编码器解码器架构的典型场景是机器翻译。而对于理解类场景，使用编码器only架构即可。对于标准的自回归生成式语言模型，使用解码器only架构即可，此时解码器中的<code>编码器-解码器多头注意力</code>也应直接去掉。</p>
<p>了解了Transformer的整体架构后，我们再来讨论<strong>KV Cache到底缓存的是什么</strong>。</p>
<ul>
<li>训练阶段是不需要做KV Cache的，这是因为整个输入序列是已知的，模型可以一次性算出所有位置的KV和注意力结果。</li>
<li>在预测阶段，由于词元是一个个生成的，所以Q是一个个产生的，那么历史的Q（作为后续Q的KV）肯定是需要保存的。但是历史的Q转化为KV参与注意力计算的过程中，有一步其实是重复性计算，那就是KV投影，也就是<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="6.329ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 2797.5 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(k)}\mathbf k"><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(k)}"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(k)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="k" transform="translate(389,0)"><path data-c="1D458" d="M409 353C409 327 423 314 450 314C485 314 508 345 508 379C508 418 476 445 437 445C392 445 344 415 291 356C250 311 217 282 190 269L291 679C289 688 287 694 274 694C242 694 166 685 154 684C139 682 132 675 132 660C132 650 141 645 159 645C178 645 204 646 204 632L59 43C56 32 55 25 55 21C55 0 66-11 87-11C104-11 117-3 124 12C129 21 147 92 179 226C231 221 286 196 286 146C286 131 279 101 279 91C279 34 316-11 373-11C431-11 470 41 490 145C490 154 485 159 475 159C466 159 460 152 457 138C435 59 408 19 375 19C357 19 348 33 348 61C348 77 360 131 360 147C360 204 314 239 221 253C244 269 270 292 298 322C326 352 346 371 359 382C386 404 412 415 435 415C445 415 453 413 459 409C432 404 409 379 409 353Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(910,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf k" data-mjx-texclass="ORD" transform="translate(2190.5,0)"><g data-mml-node="mi" data-latex="k"><path data-c="1D424" d="M587 0L587 47L570 47C527 47 524 51 511 67L342 278L472 379C486 390 495 397 562 397L562 444C535 441 510 441 484 441L369 444L369 397C392 397 395 394 403 386L214 237L214 694L37 686L37 639C99 639 106 639 106 600L106 47L37 47L37 0L157 3L278 0L278 47L209 47L209 174C238 197 246 203 266 217L367 91C376 79 392 59 392 56C392 47 374 47 361 47L361 0C391 2 478 3 483 3C519 3 553 2 587 0Z"/></g></g></g></g></svg></mjx-container></span>和<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.682ex;" xmlns="http://www.w3.org/2000/svg" width="6.272ex" height="3.076ex" role="img" focusable="false" viewBox="0 -1057.9 2772.1 1359.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathbf W_i^{(v)}\mathbf v"><g data-mml-node="msubsup" data-latex="\mathbf W_i^{(v)}"><g data-mml-node="TeXAtom" data-latex="\mathbf W" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="W"><path data-c="1D416" d="M1164 639L1164 686C1137 685 1102 683 1057 683C1019 683 957 683 921 686L921 639C946 639 994 639 1023 628L851 181L674 639L770 639L770 686C732 683 638 683 595 683C556 683 477 683 442 686L442 639L528 639L569 533L433 181L256 639L352 639L352 686C314 683 220 683 177 683C138 683 59 683 24 686L24 639L110 639L350 18C356 2 360-8 385-8C410-8 414 2 420 18L594 468L768 18C774 2 778-8 803-8C828-8 832 2 838 18L1069 615C1075 632 1076 634 1107 637C1127 639 1148 639 1164 639Z"/></g></g><g data-mml-node="TeXAtom" transform="translate(1222,529) scale(0.707)" data-latex="{(v)}" data-mjx-texclass="ORD"><g data-mml-node="mo" data-latex="("><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="mi" data-latex="v" transform="translate(389,0)"><path data-c="1D463" d="M369 391C369 383 378 370 394 350C410 330 418 307 418 281C418 252 404 203 375 134C354 86 306 18 247 18C201 18 178 45 178 100C178 139 197 208 235 307C243 328 247 345 247 357C247 407 213 442 163 442C119 442 84 417 59 367C39 326 29 300 29 287C29 278 34 273 45 273C58 273 60 279 64 293C87 373 119 413 160 413C173 413 180 404 180 385C180 369 175 347 164 318C127 219 108 152 108 115C108 64 125 29 159 10C186-4 214-11 243-11C332-11 394 85 420 162C452 256 468 325 468 369C468 418 452 442 421 442C396 442 369 416 369 391Z"/></g><g data-mml-node="mo" data-latex=")" transform="translate(874,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g><g data-mml-node="mi" transform="translate(1222,-293.8) scale(0.707)" data-latex="i"><path data-c="1D456" d="M284 621C284 648 271 661 244 661C216 661 188 633 188 605C188 578 202 565 229 565C257 565 284 593 284 621M259 138C237 59 205 19 164 19C151 19 144 28 144 47C144 64 173 150 232 306C240 329 244 347 244 360C244 409 210 445 161 445C118 445 84 420 59 369C39 328 29 301 29 288C29 279 34 275 45 275C58 275 60 281 64 295C87 375 118 415 158 415C171 415 178 406 178 387C178 373 175 357 168 338C145 275 121 208 101 155C86 115 78 88 78 74C78 25 114-11 162-11C205-11 239 14 264 64C283 103 293 130 293 145C293 154 288 159 277 159C274 159 259 150 259 138Z"/></g></g><g data-mml-node="TeXAtom" data-latex="\mathbf v" data-mjx-texclass="ORD" transform="translate(2165.1,0)"><g data-mml-node="mi" data-latex="v"><path data-c="1D42F" d="M580 397L580 444C555 442 526 441 501 441L410 444L410 397C429 397 458 394 458 386C458 386 458 384 453 374L337 124L210 397L264 397L264 444L140 441L26 444L26 397L90 397L265 21C277-4 290-4 303-4C320-4 330-1 340 20L506 376C512 390 516 397 580 397Z"/></g></g></g></g></svg></mjx-container></span>。所以KV Cache本质上缓存的就是这个投影向量值。KV Cache并没有改变<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="5.687ex" height="2.448ex" role="img" focusable="false" viewBox="0 -833.9 2513.6 1081.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n^2)"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msup" data-latex="n^2" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mn" transform="translate(633,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2124.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>的复杂度，而是消除掉了原本计算量很大的计算KV投影的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="5.687ex" height="2.448ex" role="img" focusable="false" viewBox="0 -833.9 2513.6 1081.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n^2)"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msup" data-latex="n^2" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mn" transform="translate(633,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2124.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>个矩阵乘法，只剩计算更简单的<span class="firekylin-markdown-mathjax-inline"><mjx-container class="MathJax" jax="SVG" overflow="overflow"><svg style="vertical-align: -0.561ex;" xmlns="http://www.w3.org/2000/svg" width="5.687ex" height="2.448ex" role="img" focusable="false" viewBox="0 -833.9 2513.6 1081.9"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math" data-latex="\mathcal{O}(n^2)"><g data-mml-node="TeXAtom" data-latex="\mathcal{O}" data-mjx-texclass="ORD"><g data-mml-node="mi" data-latex="O"><path data-c="4F" d="M583 525C583 424 528 266 490 194C429 83 352 28 258 28C211 28 174 46 147 83C129 108 120 144 120 193C120 238 127 290 142 349C172 472 233 570 324 643L308 660C283 647 264 634 249 622C154 545 90 442 57 312C46 270 41 230 41 192C41 134 53 88 78 55C115 6 163-18 223-18C372-18 485 51 562 190C605 268 663 421 659 530C656 621 605 686 514 686C402 686 321 596 299 505C290 472 292 448 304 432C311 421 322 415 338 415C365 415 382 427 389 451C394 467 394 480 387 489C372 508 365 526 365 542C365 570 380 595 411 616C439 635 468 645 497 645C558 645 583 584 583 525Z"/></g></g><g data-mml-node="mo" data-latex="(" transform="translate(699,0)"><path data-c="28" d="M318-248C327-248 332-243 332-234C332-231 330-227 327-223C275-183 233-117 202-26C175 53 161 131 161 208L161 292C161 369 175 447 202 526C233 617 275 683 327 723C330 726 332 730 332 734C332 743 327 748 318 748C317 748 314 747 311 745C251 699 201 631 160 540C121 453 101 371 101 292L101 208C101 129 121 47 160-40C201-131 251-199 311-245C314-247 317-248 318-248Z"/></g><g data-mml-node="msup" data-latex="n^2" transform="translate(1088,0)"><g data-mml-node="mi" data-latex="n"><path data-c="1D45B" d="M537 137C514 58 481 18 440 18C427 18 420 28 420 47C420 61 426 84 438 115C478 224 498 296 498 333C498 403 451 442 381 442C322 442 271 416 230 363C222 407 187 442 136 442C80 442 58 390 44 345C34 313 29 294 29 287C29 278 34 273 45 273C50 273 53 274 56 276C61 285 64 292 65 299C83 375 106 413 133 413C151 413 160 399 160 371C160 358 155 331 144 290L87 63C84 50 78 24 78 19C78-1 89-11 111-11C130-11 144-1 151 19C153 24 159 49 170 92L191 181L221 295C232 318 249 341 270 365C299 397 335 413 378 413C411 413 427 391 427 348C427 310 406 234 363 120C356 102 353 87 353 74C353 25 390-11 438-11C482-11 517 14 542 64C561 104 571 131 571 144C571 153 566 158 555 158C552 158 537 149 537 137Z"/></g><g data-mml-node="mn" transform="translate(633,363) scale(0.707)" data-latex="2"><path data-c="32" d="M237 666C186 666 143 648 106 612C69 576 50 534 50 483C50 449 75 424 106 424C136 424 161 450 161 480C161 513 137 536 105 536C102 536 100 536 98 535C117 584 161 627 224 627C306 627 352 556 352 470C352 403 318 331 250 255L62 43C49 28 50 29 50 0L421 0L450 180L417 180C409 129 402 100 396 91C391 86 361 84 306 84L139 84L236 179C304 243 390 312 419 365C439 400 449 435 449 470C449 588 357 666 237 666Z"/></g></g><g data-mml-node="mo" data-latex=")" transform="translate(2124.6,0)"><path data-c="29" d="M78-245C138-199 188-131 229-40C268 47 288 129 288 208L288 292C288 371 268 453 229 540C188 631 138 699 78 745C75 747 72 748 71 748C62 748 57 743 57 734C57 730 59 726 62 723C114 683 156 617 187 526C214 447 228 369 228 292L228 208C228 131 214 53 187-26C156-117 114-183 62-223C59-227 57-231 57-234C57-243 62-248 71-248C72-248 75-247 78-245Z"/></g></g></g></svg></mjx-container></span>个点积。</li>
</ul>
<p>在论文的原始实现中，解码器和编码器的embedding层、输出线性层使用的是相同的参数。但是这样做的前提是源、目标词表一致。至于输出线性层与embedding使用同一个权重的情况下怎么得到输出，我们可以通过decoder的隐状态向量与词表里面每一个词向量做内积，内积越大，代表隐状态和这个词向量越相似，这个词就越可能是输出。</p>
<p>此外，论文还使用了一个叫做Label smoothing（标签平滑）的正则化技术，它将原本极端的独热标签“软化”，将概率分出一些给其他错误的类别，从而防止模型在训练时变得过于自信，提高模型的泛化能力。</p>
<h2><a id="toc-a6c" class="anchor" href="#toc-a6c"></a>【TODO】Transformers for Vision（视觉Transformer）</h2><h2><a id="toc-454" class="anchor" href="#toc-454"></a>【TODO】Large-Scale Pretraining with Transformers（Transformer的大规模预训练）</h2><h1><a id="toc-b19" class="anchor" href="#toc-b19"></a>【TODO】优化算法</h1><h1><a id="toc-738" class="anchor" href="#toc-738"></a>【TODO】计算性能</h1>
            ]]></description>
            <pubDate>Sat, 11 Jul 2026 10:23:07 GMT</pubDate>
            <guid>https://fanzheng.org/post/d2l-notes.html</guid>
        </item>
        <item>
            <title>firekylin博客系统升级优化记录</title>
            <link>https://fanzheng.org/post/firekylin-bo-ke-xi-tong-sheng-ji-you-hua-ji-lu.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#toc-2cc">新功能</a></li><ul><li><a href="#toc-9c5">Markdown 编辑器大幅增强</a></li><li><a href="#toc-e72">Markdown 渲染能力升级</a></li><li><a href="#toc-e90">分类（Categories）功能</a></li><li><a href="#toc-092">文章草稿选项卡</a></li></ul><li><a href="#toc-b3c">Bug 修复</a></li><ul><li><a href="#toc-6ec">链接 URL 编码问题</a></li><li><a href="#toc-052">Markdown 编辑器修复</a></li><li><a href="#toc-feb">后台管理页面修复</a></li><li><a href="#toc-bb8">渲染相关修复</a></li><li><a href="#toc-bde">Ant Design v4 升级回归修复</a></li><li><a href="#toc-fa9">迁移与构建修复</a></li></ul><li><a href="#toc-ae1">其他改动</a></li><ul><li><a href="#toc-c94">Ant Design v3 → v4 迁移</a></li><li><a href="#toc-a53">Markdown 渲染引擎升级</a></li><li><a href="#toc-616">编辑器代码优化与清理</a></li><li><a href="#toc-53d">依赖与构建维护</a></li></ul><li><a href="#toc-1e9">主题改动</a></li><ul><li><a href="#toc-82a">代码块样式优化</a></li><li><a href="#toc-662">目录（TOC）优化</a></li><li><a href="#toc-a79">排版与样式</a></li><li><a href="#toc-f67">交互与功能</a></li><li><a href="#toc-54e">其他主题改动</a></li></ul><li><a href="#toc-25f">总结</a></li></ul></div><p>之前有了想要把博客彻底统一的想法，考虑到后续使用的方便，决定对<a href="https://github.com/firekylin/firekylin">firekylin博客系统</a>（包括主题）进行一轮优化，把发现的Bug也都修掉。没想到这一晃就搞了好久，不过好在把想改的地方都改完了。</p>
<p>下面的内容是我用AI综合我的改动提纲+commit信息整理汇总生成，然后手动修改校对，可以认为覆盖比较全面、准确。</p>
<hr>
<blockquote>
<p>本文记录了对 Firekylin 博客系统进行的一系列升级优化工作，涵盖系统核心、编辑器、Markdown 渲染、后台管理以及自定义主题等多个方面。改动主要集中在 <code>master</code> 分支（系统核心）和 <code>fanzheng.org</code> 分支（自定义主题）上。</p>
</blockquote>
<h1><a id="toc-2cc" class="anchor" href="#toc-2cc"></a>新功能</h1><h2><a id="toc-9c5" class="anchor" href="#toc-9c5"></a>Markdown 编辑器大幅增强</h2><p>这是本次升级中改动最大的部分，对后台 Markdown 编辑器进行了全面的功能增强，使其编辑体验向 GitHub Markdown 编辑器看齐。</p>
<p><strong>图标全部升级为 SVG</strong>：替换原有图标方案，统一使用 SVG 格式（<code>ce4edda</code>）。</p>
<p><strong>新增富文本快捷键</strong>：快捷键对齐 GitHub Markdown Editor 的行为（<code>ff41157</code>）</p>
<table>
<thead>
<tr>
<th>快捷键</th>
<th>功能</th>
</tr>
</thead>
<tbody><tr>
<td><code>Ctrl+B</code></td>
<td>加粗</td>
</tr>
<tr>
<td><code>Ctrl+I</code></td>
<td>斜体</td>
</tr>
<tr>
<td><code>Ctrl+K</code></td>
<td>快速链接</td>
</tr>
<tr>
<td><code>Ctrl+L</code></td>
<td>链接</td>
</tr>
<tr>
<td><code>Ctrl+Q</code></td>
<td>引用</td>
</tr>
<tr>
<td><code>Ctrl+E</code></td>
<td>行内代码</td>
</tr>
<tr>
<td><code>Ctrl+Shift+E</code></td>
<td>代码段</td>
</tr>
<tr>
<td><code>Ctrl+G</code></td>
<td>图片</td>
</tr>
<tr>
<td><code>Ctrl+Shift+7</code></td>
<td>有序列表</td>
</tr>
<tr>
<td><code>Ctrl+Shift+8</code></td>
<td>无序列表</td>
</tr>
<tr>
<td><code>Ctrl+H</code></td>
<td>标题</td>
</tr>
<tr>
<td><code>Ctrl+R</code></td>
<td>分割线</td>
</tr>
<tr>
<td><code>Ctrl+M</code></td>
<td>插入more标签</td>
</tr>
</tbody></table>
<p><strong>列表操作增强</strong>：</p>
<ul>
<li>有序列表和无序列表支持智能识别：当选中行不全是列表时全部添加列表标记，全是列表时全部去掉（<code>ffdb26a</code>）</li>
<li>点按回车时智能插入新的列表行，空列表行自动删除（<code>c6950a8</code>）</li>
</ul>
<p><strong>链接插入优化</strong>：</p>
<ul>
<li>链接和快速链接插入后，编辑器会根据上下文智能决定选中 <code>text</code> 还是 <code>url</code> 部分（<code>e6b99e5</code>）</li>
</ul>
<p><strong>其他编辑器功能</strong>：</p>
<ul>
<li>支持 <code>Tab</code> / <code>Shift+Tab</code> 缩进操作（<code>ee11695</code>）</li>
<li>增加删除线、下划线、行内代码、快速链接、键盘按键（<code>&lt;kbd&gt;</code>）等富文本功能（<code>5583abe</code>）</li>
<li>编辑器支持等宽字符模式（monospace），方便编写代码（<code>b71cc94</code>）</li>
</ul>
<h2><a id="toc-e72" class="anchor" href="#toc-e72"></a>Markdown 渲染能力升级</h2><ul>
<li><strong>Footnotes 支持</strong>：新增脚注语法（<code>cbae59d</code>）</li>
<li><strong>Alert 支持</strong>：支持 GitHub 风格的 Alert 语法（<code>33aba9d</code>），增加 Alert 富文本插入功能（<code>65ede6f</code>）</li>
<li><strong>LaTeX 公式添加 className</strong>：方便通过 CSS 自定义公式样式（<code>20d5550</code>）</li>
<li><strong>纯图片段落加 className</strong>：纯图片段落增加 class 以支持自定义样式（<code>c485960</code>）</li>
</ul>
<h2><a id="toc-e90" class="anchor" href="#toc-e90"></a>分类（Categories）功能</h2><p>新增分类功能支持，包括后台分类管理页面和前台分类页面，同时添加了相关图标并切换为 SVG 格式（<code>0a02e95</code>）。</p>
<h2><a id="toc-092" class="anchor" href="#toc-092"></a>文章草稿选项卡</h2><p>文章管理的文章列表页增加了草稿选项卡，方便快速查看和管理草稿状态的文章（<code>b8edcca</code>）。</p>
<h1><a id="toc-b3c" class="anchor" href="#toc-b3c"></a>Bug 修复</h1><h2><a id="toc-6ec" class="anchor" href="#toc-6ec"></a>链接 URL 编码问题</h2><p>文章链接存在多处 URL 未正确 encode 的问题，涉及多个页面：</p>
<ul>
<li>post 页的上一篇/下一篇链接、文章编辑页中的文章链接未 encode，导致含中文或特殊字符的路径无法跳转</li>
<li>搜索结果页的文章链接未 encode</li>
<li>标签和分类在 tags 页、categories 页、post 页的链接 encode 遗漏</li>
<li>手动添加分类和标签时的 encode 行为与编辑器自动添加的行为不一致，统一去除手动 encode</li>
</ul>
<p>相关提交：<code>8502120</code>、<code>49057ab</code>、<code>5eb263b</code>、<code>e9ec988</code></p>
<h2><a id="toc-052" class="anchor" href="#toc-052"></a>Markdown 编辑器修复</h2><ul>
<li><strong>撤销/重做失效</strong>：编辑器通过工具栏插入文本后无法撤销/重做，同时 <code>_preInputText</code> 未正常更新 localStorage，以及点击富文本按钮后没有激活 textarea（<code>e8fc126</code>）</li>
</ul>
<h2><a id="toc-feb" class="anchor" href="#toc-feb"></a>后台管理页面修复</h2><ul>
<li><strong>阅读设置页面</strong>：二次进入时首页选项显示异常，原因是旧的不规范写法导致数据未正确回填（<code>410fffa</code>）</li>
<li><strong>标签编辑页</strong>：进入添加标签页时表单没有清空，残留上次数据（<code>a3712f8</code>）</li>
<li><strong>分类和标签</strong>：文章关联的分类和标签添加后无法彻底删除（<code>87b53d1</code>）</li>
<li><strong>分类编辑页</strong>：MobX 升级后 <code>categoryInfo</code> 没有初始化，由于 tsconfig 的设置导致 MobX 忽略（<code>1966438</code>）</li>
</ul>
<h2><a id="toc-bb8" class="anchor" href="#toc-bb8"></a>渲染相关修复</h2><ul>
<li><strong>LaTeX 公式失效</strong>：marked 升级后 LaTeX 公式渲染失效（<code>d499288</code>）</li>
<li><strong>标题含公式时 TOC 不一致</strong>：标题中含有数学公式时，正文渲染和 TOC 目录的锚点不一致、TOC 标题渲染异常。通过将 MathJax 和 TOC 改写为 Marked Extension 形式彻底解决（<code>82da60a</code>）</li>
<li><strong>page 手动指定 toc 不生效</strong>：page 类型文章即使手动指定 toc 也不生成目录（<code>8a26235</code>）</li>
<li><strong>page 与 post 的 DOM 结构不一致</strong>：导致主题脚本在 page 页不执行（<code>ef0b669</code>）</li>
</ul>
<h2><a id="toc-bde" class="anchor" href="#toc-bde"></a>Ant Design v4 升级回归修复</h2><p>Ant Design v3 → v4 升级后暴露出大量历史不规范写法导致的回归问题，逐一修复：</p>
<ul>
<li>category/upload/tag/push/user 页表单不规范写法失效 &amp; 已废弃 React 接口重写（<code>475af7f</code>）</li>
<li>user 页 <code>submitting</code> 和 <code>hasEmail</code> 初始化状态不正确导致页面状态异常（<code>d9b6042</code>）</li>
<li>文章编辑页标题不更新（<code>144b321</code>）</li>
<li>post 页对 antd 类名的硬依赖导致升级后样式失效（<code>26f4266</code>）</li>
<li>外观设置-菜单管理 button 样式恢复（<code>a7c382d</code>）</li>
<li>几个默认行为变更导致的样式问题（<code>585094a</code>）</li>
<li>系统设置-阅读设置无法显示默认数据（<code>96775f6</code>）</li>
<li>form 默认样式变更导致的样式变化（<code>001b090</code>）</li>
<li>LDAP 设置页无法显示默认数据（<code>16d74af</code>）</li>
<li>登录页&quot;自动登录&quot;与&quot;找回密码&quot;不在同一行（<code>50882a7</code>）</li>
</ul>
<h2><a id="toc-fa9" class="anchor" href="#toc-fa9"></a>迁移与构建修复</h2><ul>
<li><strong>axios 拦截器失效</strong>：迁移到 Vite 后，CJS → ESM 转换导致 axios 拦截器不工作（<code>9121a8a</code>）</li>
<li><strong>MobX v5 不兼容</strong>：迁移到 Vite 后与 MobX v5 不兼容导致后台打不开，升级 MobX v6 解决（<code>fa7e11e</code>）</li>
<li><strong>Vite 产物缓存</strong>：Vite 产物未添加 hash，导致管理页更新后被浏览器缓存（<code>7e464c7</code>）</li>
<li><strong>Dockerfile 资源文件不全</strong>：release 版本没正确执行 sqlite3 的 postinstall，Dockerfile 资源文件复制不全导致无法启动（<code>67dea83</code>）</li>
<li><strong>release.yml 版本过滤逻辑</strong>：版本过滤逻辑问题导致无法正常自动 release（<code>9650c7d</code>）</li>
<li><strong>pnpm-workspace.yaml</strong>：加回 pnpm-workspace.yaml，修复 pnpm v9 兼容问题（<code>233fe88</code>、<code>ab78347</code>）</li>
<li><strong>直接依赖未显式声明</strong>：部分直接依赖没有显式写在 package.json 中（<code>44da6ef</code>）</li>
</ul>
<h1><a id="toc-ae1" class="anchor" href="#toc-ae1"></a>其他改动</h1><h2><a id="toc-c94" class="anchor" href="#toc-c94"></a>Ant Design v3 → v4 迁移</h2><p>Ant Design v4 的初始迁移由迁移工具完成（生成第一个可编译版本），在此基础上进行了大量后续工作：</p>
<ul>
<li>去除兼容性处理，清理废弃 API（<code>6d59c45</code>）</li>
<li>Button 组件规范化改造（<code>12ef079</code>）</li>
<li>后端依赖的 moment.js 迁移到 dayjs（<code>1484db1</code>）</li>
<li>逐一修复升级后的回归问题（详见「Ant Design v4 升级回归修复」一节）</li>
</ul>
<h2><a id="toc-a53" class="anchor" href="#toc-a53"></a>Markdown 渲染引擎升级</h2><ul>
<li><strong>marked 升级</strong>：从 v4 升级到 v18（<code>773c580</code>）</li>
<li><strong>MathJax 升级</strong>：从 v2 升级到 v4，去除 mathjax-node 依赖（<code>f24061a</code>），公式渲染改为使用 MathJax 4 直接渲染为 SVG</li>
<li><strong>代码高亮重构</strong>：将代码高亮重构为插件实现，并升级 highlight.js 版本（<code>158a0e9</code>）</li>
<li><strong>MathJax 和 TOC 改写为 Marked Extension</strong>：解决标题含公式时的 TOC 锚点不一致问题（<code>82da60a</code>）</li>
</ul>
<h2><a id="toc-616" class="anchor" href="#toc-616"></a>编辑器代码优化与清理</h2><ul>
<li>清理编辑器无用代码，marked 升级后默认不支持 HTML 过滤（<code>95a542b</code>）</li>
<li>优化富文本标签插入的文本（<code>956014a</code>）</li>
<li>编辑器快捷键函数结构重构（<code>15964fb</code>）</li>
</ul>
<h2><a id="toc-53d" class="anchor" href="#toc-53d"></a>依赖与构建维护</h2><ul>
<li>清理不必要的依赖 &amp; 升级部分依赖（<code>4ba1847</code>）</li>
<li>多次 Dockerfile 修复与调整（<code>c50d7b0</code>、<code>5ceefd0</code>、<code>75f1ed0</code>、<code>2a4959b</code>）</li>
</ul>
<h1><a id="toc-1e9" class="anchor" href="#toc-1e9"></a>主题改动</h1><blockquote>
<p>主题的改动在 <code>fanzheng.org</code> 分支上，基于默认主题进行优化。</p>
</blockquote>
<h2><a id="toc-82a" class="anchor" href="#toc-82a"></a>代码块样式优化</h2><ul>
<li>代码行号 CSS 样式规范化（<code>38fb127</code>、<code>e1aafbd</code>）</li>
<li>不超过 5 行的代码块不显示行号，避免短代码段的视觉干扰（<code>cf72e0e</code>）</li>
<li>修改代码块字体，合并冗余样式（<code>39f3ca5</code>）</li>
<li>行间代码样式调整，代码显示更扁平，行号标记做了相应调整</li>
<li>基于 highlight.js 的 CSS 优化代码高亮显示效果</li>
</ul>
<h2><a id="toc-662" class="anchor" href="#toc-662"></a>目录（TOC）优化</h2><ul>
<li>实现右侧目录悬浮效果（<code>24f8042</code>）</li>
<li>目录标题自动添加序号（<code>ba5622d</code>）</li>
<li>目录标题跟随页面滚动自动高亮当前阅读位置（<code>1426098</code>）</li>
<li>文章正文标题也支持自动编号（<code>9839140</code>）</li>
<li>目录标题增加 hover title 提示（<code>5f618fe</code>）</li>
</ul>
<h2><a id="toc-a79" class="anchor" href="#toc-a79"></a>排版与样式</h2><ul>
<li>行内代码样式微调</li>
<li>blockquote 引用块样式优化</li>
<li>图片自动缩放，适配不同屏幕宽度</li>
<li>块级公式居中</li>
<li>多张图片并排居中（<code>32a0a97</code>）</li>
<li>表情图片去除默认边框（<code>e35aad9</code>）</li>
<li>水平分隔线样式修改（<code>5c0ddec</code>）</li>
<li><code>&lt;em&gt;</code> 标签的斜体字改为楷体字显示，更符合中文排版习惯（<code>64c640a</code>）</li>
<li>发布时间样式调整（<code>2de5092</code>）</li>
</ul>
<h2><a id="toc-f67" class="anchor" href="#toc-f67"></a>交互与功能</h2><ul>
<li>外部链接在新标签页打开（target blank）</li>
<li>脚注去掉标题的编号，脚注编号加方括号（<code>c631f7e</code>）</li>
<li>Alert 组件样式优化，alert title 替换成中文（<code>fd419a0</code>）</li>
<li>键盘按键（kbd）样式优化（<code>4cd4d29</code>）</li>
<li>评论区样式和提示信息优化</li>
</ul>
<h2><a id="toc-54e" class="anchor" href="#toc-54e"></a>其他主题改动</h2><ul>
<li>去掉文章底部的 EOF 标记、本文链接等冗余信息</li>
<li>删去不必要的作者信息，优化布局样式</li>
<li>去掉默认列表样式（<code>6a7d019</code>）</li>
<li>page 页增加日期时间等信息（<code>4d1536b</code>），保持与 post 页一致的 DOM 结构（<code>4f9cc5a</code>）</li>
<li>增加 music 等图标（<code>0aaea11</code>、<code>2cc3077</code>）</li>
<li>注释掉热搜词（<code>68bbd60</code>）</li>
<li>去掉 post.content 的 replace（<code>15984bd</code>）</li>
</ul>
<h1><a id="toc-25f" class="anchor" href="#toc-25f"></a>总结</h1><p>本次升级优化工作涉及面广，主要成果包括：</p>
<ol>
<li><strong>Markdown 编辑体验质的飞跃</strong>：从仅有基础功能的编辑器，升级为支持丰富快捷键、智能列表操作、多种富文本格式的专业级编辑器，体验向 GitHub 编辑器看齐</li>
<li><strong>渲染引擎全面升级</strong>：marked v4 → v18、MathJax v2 → v4、highlight.js 升级，支持 Footnotes、Alert 等 GitHub 风格 Markdown，并将 MathJax 和 TOC 重构为 Marked Extension 插件形式</li>
<li><strong>Ant Design v4 迁移</strong>：完成 v3 → v4 升级的后续回归修复工作，清理废弃 API，迁移 moment → dayjs</li>
<li><strong>主题体验优化</strong>：代码块、目录、排版、交互等全方位优化，阅读体验显著提升</li>
<li><strong>后台管理功能完善</strong>：新增分类功能、草稿选项卡，修复大量后台页面的回归问题</li>
</ol>

            ]]></description>
            <pubDate>Mon, 01 Jun 2026 14:55:21 GMT</pubDate>
            <guid>https://fanzheng.org/post/firekylin-bo-ke-xi-tong-sheng-ji-you-hua-ji-lu.html</guid>
        </item>
        <item>
            <title>博客合并迁移记录</title>
            <link>https://fanzheng.org/post/bo-ke-he-bing-qian-yi-ji-lu.html</link>
            <description><![CDATA[
            <p>主博客停更许久，一方面是因为要求自己写超高质量长文的压力太大，往往因为时间和精力不允许导致望而却步；另一方面是因为静态博客维护起来终究是更麻烦一些的，关键我的博客系统还是自己写的，各方面能力跟成熟的博客系统相比还有较大差距，使用起来过于麻烦。</p>
<p>与此同时，由于debug博客写起来没有什么压力，一直在持续更新，记录日常遇到的各类问题；其中也不乏一些长文，记录了我对一些事情和问题的系统性的调研与思考。</p>
<p><strong>因此最终决定将两个博客合并，统一使用主站域名</strong>。下面记录一下合并迁移主要做了哪些工作（其中针对firekylin博客系统本身的优化见下一篇文章）。</p>
<p>原主站文章统一打了<a href="https://fanzheng.org/tag/%E4%B8%BB%E5%8D%9A%E5%AE%A2%E5%90%88%E5%B9%B6%E8%BF%81%E7%A7%BB">主博客合并迁移</a>的tag，文章列表可以打开tag看到。</p>
<p>总体来说，合并迁移工作主要做了这几个事情：</p>
<ul>
<li>样式和元素统一：包括主站背景图融合到debug博客，首页相关链接图标、about/links等页面补充到debug博客等</li>
<li>静态文件迁移：主要是img包括表情包、files等，以及可能仍被依赖的bootstrap/jQuery文件等</li>
<li>自部署的相关程序和对应文件迁移（主要是音乐页面）</li>
<li>文章迁移：检查依赖的图片和文件及其指向的链接，部分需要修改路径；检查部分页面的表单、按钮之类可能要引入bootstrap/jQuery</li>
<li>重定向配置：主站本身的nginx path重定向配置（实现原链接能无缝重定向到新链接）；debug博客重定向到主站<ul>
<li>涉及到的主站链接：<ul>
<li><code>archives</code>、<code>music</code>、<code>page</code>、<code>tags</code>、<code>tt-rss</code>，页面<code>about</code>（不变）、<code>links</code>（不变）、<code>/archive</code>-&gt;<code>/archives/</code>、<code>/feed-&gt;/rss.html</code>等</li>
<li>验证链接：<pre><code class="hljs lang-text">https://fanzheng.org/
https://fanzheng.org/archives/41
https://fanzheng.org/page/2
https://fanzheng.org/archive
https://fanzheng.org/tags/
https://fanzheng.org/tags/Blog
https://fanzheng.org/links
https://fanzheng.org/about
https://fanzheng.org/feed
https://fanzheng.org/music/
https://fanzheng.org/music
https://fanzheng.org/music/3d-piano-player/
</code></pre></li>
</ul>
</li>
</ul>
</li>
<li>把之前19年就已经从主博客迁移到debug的文章也加上重定向，涉及id：3 5 6 7 8 19 23</li>
<li>debug博客做改名相关配置，正式成为主站</li>
<li>nginx层面做favicon等配置，把资源文件弄到统一的common目录</li>
<li>处理waline的所有评论的url</li>
</ul>
<p>最后，给旧的主站截个图留个纪念吧！</p>
<p class="firekylin-markdown-img-only"><img src="https://fanzheng.org/static/upload/20260601/upload_f4af93350acd7be32076afbd5502fa1f.png" alt="image.png"></p>

            ]]></description>
            <pubDate>Sun, 31 May 2026 09:16:19 GMT</pubDate>
            <guid>https://fanzheng.org/post/bo-ke-he-bing-qian-yi-ji-lu.html</guid>
        </item>
        <item>
            <title>npm与pnpm的各种路径问题</title>
            <link>https://fanzheng.org/post/npm-yu-pnpm-de-ge-zhong-lu-jing-wen-ti.html</link>
            <description><![CDATA[
            <div class="toc"></div><p>AI火热，如今各类cli工具大多通过npm分发。如果单用npm的话还好，如果与pnpm混用，就可能会面临不知道执行的是哪里的cli的问题。这里把npm和pnpm的各类路径一次性讲清楚。</p>
<ul>
<li>npm<ul>
<li>下载包的cache目录<ul>
<li>查询命令：<code>npm config get cache</code></li>
<li>常见路径举例：<code>~/.npm</code></li>
</ul>
</li>
<li>环境安装路径（所有资源的路径，包括node、npm本身）<ul>
<li>查询命令：<code>npm config get prefix</code></li>
<li>常见路径举例：<code>~/.local/share/fnm/node-versions/v24.15.0/installation</code></li>
</ul>
</li>
<li>全局包的二进制目录（在安装路径下的<code>bin</code>目录中）<ul>
<li>路径：<code>$(npm config get prefix)/bin</code></li>
<li>常见路径举例：<code>~/.local/share/fnm/node-versions/v24.15.0/installation/bin</code></li>
</ul>
</li>
<li>全局包的node_modules目录（在安装路径下的<code>lib/node_modules</code>目录中）<ul>
<li>查询命令：<code>npm root -g</code></li>
<li>常见路径举例：<code>~/.local/share/fnm/node-versions/v24.15.0/installation/lib/node_modules</code></li>
</ul>
</li>
</ul>
</li>
<li>pnpm<ul>
<li>全局存储目录（所有资源的统一存储位置）<ul>
<li>查询命令：<code>pnpm store path</code></li>
<li>常见路径举例：<code>~/.local/share/pnpm/store/v11</code></li>
</ul>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>由于pnpm采用硬链接方式管理资源，如果项目与默认的全局存储目录不在同一个磁盘，在没有单独配置store-dir的情况下，会在项目所在磁盘根目录做本磁盘下的全局存储，例如<code>/mnt/d/.pnpm-store/v11</code>。</p>
</div>
</li>
<li>全局包的二进制目录<ul>
<li>路径：<code>pnpm bin -g</code></li>
<li>常见路径举例：<code>~/.local/share/pnpm/bin</code></li>
</ul>
</li>
<li>全局包的node_modules目录（实际目录在下面这个目录的<code>xxx-xxx/node_modules</code>目录下）<ul>
<li>查询命令：<code>pnpm root -g</code></li>
<li>常见路径举例：<code>~/.local/share/pnpm/global/v11</code></li>
</ul>
</li>
</ul>
</li>
</ul>

            ]]></description>
            <pubDate>Tue, 12 May 2026 14:38:22 GMT</pubDate>
            <guid>https://fanzheng.org/post/npm-yu-pnpm-de-ge-zhong-lu-jing-wen-ti.html</guid>
        </item>
        <item>
            <title>解决docker代理不生效问题</title>
            <link>https://fanzheng.org/post/jie-jue-docker-dai-li-bu-sheng-xiao-wen-ti.html</link>
            <description><![CDATA[
            <p>之前一直没有需求，没用过docker，今天尝试用了一下。</p>
<p>首先，在没有开启代理的时候，报错是这样的：</p>
<pre><code class="hljs lang-subunit"><span class="hljs-keyword">ERROR: </span>failed to build: failed to solve: xxx/yyy: failed to resolve source metadata for docker.io/xxx/yyy: failed to do request: Head &quot;https://registry<span class="hljs-string">-1</span>.docker.io/v2/xxxxx&quot;: dial tcp 67.15.100.252:443: connect: connection refused
</code></pre><p>按常规方式加上代理，新建文件<code>/etc/systemd/system/docker.service.d/proxy.conf</code>，填上代理配置，例如：</p>
<pre><code class="hljs lang-conf">[Service]
Environment=&quot;HTTP_PROXY=http://192.168.31.2:1080&quot;
Environment=&quot;HTTPS_PROXY=http://192.168.31.2:1080&quot;
Environment=&quot;NO_PROXY=localhost,127.0.0.1&quot;
</code></pre><p>然后<code>sudo systemctl daemon-reload &amp;&amp; sudo systemctl restart docker</code>。</p>
<div class="markdown-alert markdown-alert-tip">
<p class="markdown-alert-title"><svg class="octicon octicon-light-bulb mr-2" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg>Tip</p>
<p>2026-05-31 UPDATE：WXC建议按照<a href="https://docs.docker.com/engine/daemon/proxy/">docker文档</a>通过<code>daemon.json</code>来配置，而不是通过systemd给环境变量的方式来实现。</p>
</div>
<p>但是发现代理始终不生效，报错：</p>
<pre><code class="hljs lang-subunit"><span class="hljs-keyword">ERROR: </span>failed to build: failed to solve: failed to fetch anonymous token: Get &quot;https://auth.docker.io/token?scope=repository%3Axxx%3Apull&amp;service=registry.docker.io&quot;: dial tcp 128.242.240.117:443: connect: connection refused
</code></pre><p>尝试半天之后发现，是<code>auth.docker.io</code>这个地址的请求并不走docker的代理配置，所以需要结合<code>export http_proxy=http://192.168.31.2:1080 https_proxy=http://192.168.31.2:1080</code>才行。</p>
<p>附一些常见的docker命令：</p>
<pre><code class="hljs lang-bash">docker build -t firekylin .
docker images firekylin
docker run -d -p 8360:8360 firekylin
docker run -it -p 8360:8360 firekylin <span class="hljs-comment"># 交互式运行</span>
docker <span class="hljs-built_in">exec</span> -it 2a51518b8efe /bin/sh
docker stop 2a51518b8efe
docker run -it --entrypoint /bin/sh firekylin <span class="hljs-comment"># 不运行entrypoint直接进容器</span>
</code></pre>
            ]]></description>
            <pubDate>Mon, 04 May 2026 09:41:50 GMT</pubDate>
            <guid>https://fanzheng.org/post/jie-jue-docker-dai-li-bu-sheng-xiao-wen-ti.html</guid>
        </item>
        <item>
            <title>关于python与pytorch的各种配置问题与迷思</title>
            <link>https://fanzheng.org/post/myth-of-python-and-pytorch.html</link>
            <description><![CDATA[
            <div class="toc"><ul><li><a href="#python">python</a></li><ul><li><a href="#toc-f36">为什么不要使用常规的系统级安装方式而选择conda</a></li><li><a href="#toc-a70">如何正确安装conda：选择miniforge而非anaconda/miniconda</a></li><ul><li><a href="#toc-6ca">Linux安装</a></li><li><a href="#toc-2d7">Windows安装</a></li><li><a href="#toc-704">基本用法</a></li></ul><li><a href="#toc-adb"><code>.condarc</code>配置</a></li><li><a href="#toc-212">conda源（channel）详解</a></li><li><a href="#toc-224">miniforge与anaconda/miniconda在channel上默认行为的不同</a></li><li><a href="#toc-d9c">你需要哪些channel</a></li><li><a href="#toc-533">配置conda镜像源</a></li><li><a href="#toc-0e1">配置python镜像源</a></li></ul><li><a href="#pytorch">pytorch</a></li><ul><li><a href="#toc-fb4">通过pip安装</a></li><li><a href="#toc-6df">通过conda安装</a></li><li><a href="#toc-ff2">如何选择conda安装还是pip安装</a></li></ul></ul></div><p>最近开始深度搞搞AI相关东西，涉及到python和pytorch，第一步先把环境问题搞清楚。python的东西是真的乱……网上的信息几乎没有一个能完整说清楚的，大量的错误信息。</p>
<h1><a id="python" class="anchor" href="#python"></a>python</h1><h2><a id="toc-f36" class="anchor" href="#toc-f36"></a>为什么不要使用常规的系统级安装方式而选择conda</h2><p>首先安装python就是一个很大的问题，该选择什么样的安装方式呢？Linux各个发行版都自带python，Windows也可以下载安装<a href="https://www.python.org/downloads/">python windows installer</a>，但这种安装方式一律不建议，核心原因是：尽管我们可以通过venv这类环境管理软件来实现python env的创建与隔离，但每个python env所使用的python版本都只能是系统中安装的那个版本，无法灵活修改。更要命的是，Windows的installer还一大堆Bug，有无法正常卸载、卸载有残留等问题。</p>
<p>唯一正确的选择是使用conda。</p>
<h2><a id="toc-a70" class="anchor" href="#toc-a70"></a>如何正确安装conda：选择miniforge而非anaconda/miniconda</h2><p>老生常谈的问题。anaconda和miniconda是商业产品，区别是anaconda会预装很多包，miniconda仅预装必要的包，所以miniconda体积小很多。而miniforge是开源社区主导的对标miniconda的产品。<strong>选开源产品就对了！</strong></p>
<blockquote>
<p>曾经还有mamba，比miniforge性能更好，但mamba现已合并到miniforge中，所以直接用miniforge就好</p>
</blockquote>
<h3><a id="toc-6ca" class="anchor" href="#toc-6ca"></a>Linux安装</h3><p>在github上搜索<a href="https://github.com/conda-forge/miniforge">miniforge3</a>，按说明下载安装即可。安装时建议不要让它自动修改shell，手动在bashrc里添加<code>[[ -e &quot;$HOME/miniforge3/bin/conda&quot; ]] &amp;&amp; eval &quot;$($HOME/miniforge3/bin/conda shell.bash hook)&quot;</code>即可。安装完建议执行<code>conda config --set auto_activate false</code>，目的是不要让它在启动shell时自动激活。后面会详细讲<code>.condarc</code>的配置。</p>
<h3><a id="toc-2d7" class="anchor" href="#toc-2d7"></a>Windows安装</h3><p><a href="https://github.com/conda-forge/miniforge/releases">release</a>页下载安装Miniforge3-Windows-x86_64.exe即可。安装时建议不要勾选注册为系统python和添加到PATH这两个选项，自己手动配就好了。</p>
<p>手动将以下路径加到PATH中（注意这些PATH要添加在<code>%USERPROFILE%\AppData\Local\Microsoft\WindowsApps</code>的上面才行，否则会优先使用WindowsApps下的python）：</p>
<pre><code class="hljs lang-text">D:\work\library\win\miniforge3
D:\work\library\win\miniforge3\Library\mingw-w64\bin
D:\work\library\win\miniforge3\Library\usr\bin
D:\work\library\win\miniforge3\Library\bin
D:\work\library\win\miniforge3\Scripts
</code></pre><h3><a id="toc-704" class="anchor" href="#toc-704"></a>基本用法</h3><pre><code class="hljs lang-bash"><span class="hljs-comment"># 创建名为test的环境</span>
conda create -n <span class="hljs-built_in">test</span> python=3.14
<span class="hljs-comment"># 删除为test的环境</span>
conda remove -n <span class="hljs-built_in">test</span> --all
<span class="hljs-comment"># 进入名为test的环境</span>
conda activate <span class="hljs-built_in">test</span>
<span class="hljs-comment"># 退出当前python环境</span>
conda deactivate
</code></pre><h2><a id="toc-adb" class="anchor" href="#toc-adb"></a><code>.condarc</code>配置</h2><p>首先，conda是一个通用的包管理器，可以装各种软件和python包，而pip只能用来装python包。但conda和pip使用的是完全不同的源，管理方式也不同，即使是同名的python包内容也可能不同。</p>
<p>我们先来看一个典型的<code>.condarc</code>是什么样的：</p>
<pre><code class="hljs lang-yaml"><span class="hljs-attr">channels:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">conda-forge</span>
<span class="hljs-attr">show_channel_urls:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">auto_activate:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">default_channels:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2</span>
<span class="hljs-attr">custom_channels:</span>
  <span class="hljs-attr">conda-forge:</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span>
  <span class="hljs-attr">pytorch:</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span>
</code></pre><p>配置细节详见<a href="https://docs.conda.io/projects/conda/en/latest/configuration.html">文档</a>。首先是两个建议配置：</p>
<ul>
<li><code>show_channel_urls</code>: 下载时显示是从哪个URL下载的</li>
<li><code>auto_activate</code>: 启动shell时自动激活python默认环境（base），很多地方写的配置都是<code>auto_activate_base</code>，其实是一样的</li>
</ul>
<p>剩下的三个配置是channel相关的，下面详细讲。</p>
<h2><a id="toc-212" class="anchor" href="#toc-212"></a>conda源（channel）详解</h2><p>首先要搞懂channel是个什么概念。channel是指conda包分发的通道，例如最大的channel是社区维护的<a href="https://anaconda.org/channels/conda-forge">conda-forge</a>，<a href="https://anaconda.org/channels/nvidia">nvidia</a>也有自己维护的channel。不同的channel提供了不同的软件集合（当然不同的channel里也可能有相同的软件）。相当于把软件包套了层namespace，不同组织各自维护自己的channel（当然一个组织也可能维护多个channel）。</p>
<p>接下来看<code>channels</code>、<code>default_channels</code>、<code>custom_channels</code>这三个channel相关的配置是在配什么：</p>
<ul>
<li><code>channels</code>: 指定使用<code>conda create</code>和<code>conda install</code>这些命令时从哪些channel里搜索和安装。这里只需要写channel的别名，例如conda-forge。其中defaults是一个特殊的别名，下面会讲。</li>
<li><code>custom_channels</code>：指定channel别名所对应的地址，<code>conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</code>指在使用conda-forge这个channel时，需要访问<code>https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge</code>来搜索和安装。</li>
<li><code>default_channels</code>: 专门用于配置defaults的特殊配置项，它等价于在<code>custom_multichannels</code>（类似于上面的<code>custom_channels</code>，但是是用于配置别名与channel之间是一对多的情况）配置中定义defaults，例如：</li>
</ul>
<pre><code class="hljs lang-yaml"><span class="hljs-attr">custom_multichannels:</span>
  <span class="hljs-attr">defaults:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2</span>
</code></pre><p><strong>简单来说就是，<code>channels</code>指定channel别名，<code>custom_channels</code>中定义别名对应的地址，<code>default_channels</code>是定义defaults这个特殊别名所对应的地址，只不过这个别名对应了多个channel。</strong></p>
<p>对于没有写在<code>channels</code>里的<code>custom_channels</code>，默认不会进行检索，需要通过手动指定的方式来安装这些channel里的软件。手动指定有两个方法：</p>
<ol>
<li>通过<code>-c</code>参数，例如<code>conda install pytorch -c conda-forge</code>（本次conda install操作增加对conda-forge这个channel里软件的检索）</li>
<li>在包名前手动指定channel，例如<code>conda install conda-forge::pytorch</code>（从conda-forge这个channel里检索pytorch并安装，指向更加精准）</li>
</ol>
<h2><a id="toc-224" class="anchor" href="#toc-224"></a>miniforge与anaconda/miniconda在channel上默认行为的不同</h2><p>先介绍两个命令：</p>
<ul>
<li><code>conda config --show</code>: 查看补上了默认值之后的<code>.condarc</code>配置的值（当前用户配置的<code>.condarc</code>与conda默认的<code>.condarc</code>配置合并后所有的<code>.condarc</code>配置项的值）</li>
<li><code>conda info</code>: 查看conda本身的相关信息，我们可以用这个查到conda实际默认使用的channel对应的URLs（即<code>.condarc</code>中的<code>channels</code>中指定的channel别名所对应的URLs）</li>
</ul>
<p>我们再来看一下miniforge在没有在<code>.condarc</code>做任何配置时的各配置值：</p>
<pre><code class="hljs lang-yaml"><span class="hljs-attr">channels:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">conda-forge</span>
<span class="hljs-attr">channel_alias:</span> <span class="hljs-string">https://conda.anaconda.org</span>
<span class="hljs-attr">default_channels:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://repo.anaconda.com/pkgs/main</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://repo.anaconda.com/pkgs/r</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://repo.anaconda.com/pkgs/msys2</span>
<span class="hljs-attr">custom_channels:</span>
  <span class="hljs-attr">pkgs/main:</span> <span class="hljs-string">https://repo.anaconda.com</span>
  <span class="hljs-attr">pkgs/r:</span> <span class="hljs-string">https://repo.anaconda.com</span>
  <span class="hljs-attr">pkgs/msys2:</span> <span class="hljs-string">https://repo.anaconda.com</span>
  <span class="hljs-attr">pkgs/pro:</span> <span class="hljs-string">https://repo.anaconda.com</span>
</code></pre><p>可以看出，miniforge的<code>channels</code>默认使用conda-forge。</p>
<p>而剩下的<code>default_channels</code>所定义的defaults这个channel根本没用到，如果想用，可以在<code>.condarc</code>中的<code>channels</code>中把defaults加上，或者在需要时手动引入，也就是上面所说的<code>-c</code>参数例如<code>-c defaults</code>或者<code>-c pkgs/main</code>等等。</p>
<blockquote>
<p>这里需要说明一下<code>channel_alias</code>的作用是指定<code>channels</code>中配置的别名如果在<code>custom_channels</code>不存在的话，就会默认用<code>channel_alias</code>中的地址。这里就是默认用<a href="https://conda.anaconda.org/conda-forge/">https://conda.anaconda.org/conda-forge/</a>这个地址。</p>
</blockquote>
<p><strong>而miniforge与anaconda/miniconda在channel上的默认行为，唯一的不同就是：miniforge会在你配置的<code>channels</code>最后默认加上conda-forge，而anaconda/miniconda会默认加defaults！</strong></p>
<h2><a id="toc-d9c" class="anchor" href="#toc-d9c"></a>你需要哪些channel</h2><p>现在，我们该回答如何正确选择channel的问题了。</p>
<p><strong>先说结论，无论你用的是miniforge还是anaconda/miniconda（尽管并不推荐），一律建议使用conda-forge这个channel。</strong></p>
<p>再细说一下这些channel都有什么区别，都在哪里维护。</p>
<ul>
<li><a href="https://anaconda.org/">anaconda.org</a>作为统一的前端页面，可用于搜索包、浏览channel、查看版本和下载量等。例如查看<a href="https://anaconda.org/channels/conda-forge">conda-forge</a>、<a href="https://anaconda.org/channels/nvidia">nvidia</a>等channel的情况。<ul>
<li>anaconda商业官方包通过<a href="https://repo.anaconda.com/">repo.anaconda.com</a>（.com域名）分发，主要有<a href="https://repo.anaconda.com/pkgs/main/">pkgs/main</a>、<a href="https://repo.anaconda.com/pkgs/r/">pkgs/r</a>、<a href="https://repo.anaconda.com/pkgs/msys2/">pkgs/msys2</a>等，更详细的说明（例如anaconda官方还维护哪些包、哪些废弃了等）见<a href="https://repo.anaconda.com/pkgs/">pkgs页面</a>。</li>
<li>社区包通过<a href="https://conda.anaconda.org/">conda.anaconda.org</a>分发，例如<a href="https://conda.anaconda.org/conda-forge/">conda-forge</a>、<a href="https://conda.anaconda.org/nvidia/">nvidia</a>等。</li>
</ul>
</li>
</ul>
<p>conda-forge目前最为活跃，anaconda商业官方包基本上就只有<code>pkgs/main</code>还在维护，而<code>pkgs/r</code>在2025年11月4日已经停止更新，<code>pkgs/msys2</code>也早在2016年就已经停止更新（<code>pkgs/msys2</code>还有个社区版channel，但跟anaconda商业版内容是一样的），其他的也废弃的废弃，停更的停更。</p>
<p>这些包基本上在conda-forge都有，所以只用conda-forge就好了。如果真的需要anaconda商业官方包，可以在<code>channels</code>中加上defaults，或者通过<code>-c defaults</code>或<code>-c anaconda/pkgs/main</code>手动指定channel。但一定不要在<code>default_channels</code>里混配anaconda/pkgs和conda-forge，或者是在<code>channels</code>中配多个且<code>channel_priority</code>配成disabled，否则包检索会按不同源内版本高的来而非在相同channel中寻找依赖包，这可能会导致依赖冲突问题。</p>
<h2><a id="toc-533" class="anchor" href="#toc-533"></a>配置conda镜像源</h2><p>上面已经介绍了conda社区包和anaconda商业官方包的分发渠道：</p>
<ul>
<li>conda社区包：<a href="https://conda.anaconda.org/">conda.anaconda.org</a>，例如<a href="https://conda.anaconda.org/conda-forge/">https://conda.anaconda.org/conda-forge/</a></li>
<li>anaconda商业官方包：<a href="https://repo.anaconda.com/">repo.anaconda.com</a>，例如<a href="https://repo.anaconda.com/pkgs/main/">https://repo.anaconda.com/pkgs/main/</a></li>
</ul>
<p>我们要做的，就是把这两个分发渠道替换成国内的镜像站。具体的地址每个镜像站可能有略微不同。以清华tuna镜像站为例，它们都被放到了<a href="https://mirrors.tuna.tsinghua.edu.cn/anaconda">https://mirrors.tuna.tsinghua.edu.cn/anaconda</a>下：</p>
<ul>
<li>conda社区包：<a href="https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud">https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</a>，都在cloud目录下</li>
<li>anaconda商业官方包：<a href="https://mirrors.tuna.tsinghua.edu.cn/anaconda/">https://mirrors.tuna.tsinghua.edu.cn/anaconda/</a>，由于官方包都以pkgs开头，所以都在pkgs目录下。</li>
</ul>
<p>因此典型的<code>.condarc</code>的<code>default_channels</code>和<code>custom_channels</code>镜像源配置如下（<code>default_channels</code>）：</p>
<pre><code class="hljs lang-yaml"><span class="hljs-attr">default_channels:</span> <span class="hljs-comment"># 没有别名也不会自动把别名添加到URL后面，所以直接写channel的具体地址</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2</span>
<span class="hljs-attr">custom_channels:</span> <span class="hljs-comment"># 使用时自动把别名添加到URL后面，所以只需写channel源的URL前缀</span>
  <span class="hljs-attr">conda-forge:</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span>
  <span class="hljs-attr">pytorch:</span> <span class="hljs-string">https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span>
</code></pre><h2><a id="toc-0e1" class="anchor" href="#toc-0e1"></a>配置python镜像源</h2><p>上面说的都是conda源，但是python库有自己的源，也就是pip安装python包的pypi。</p>
<p>这个没什么乱七八糟特殊逻辑，直接配置就好。</p>
<ul>
<li>通过命令配置：<code>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple</code></li>
<li>手动修改配置文件：修改<code>~/.config/pip/pip.conf</code>或<code>%APPDATA%\pip\pip.ini</code>，写入如下配置</li>
</ul>
<pre><code class="hljs lang-ini"><span class="hljs-section">[global]</span>
<span class="hljs-attr">index-url</span> = https://pypi.tuna.tsinghua.edu.cn/simple
</code></pre><h1><a id="pytorch" class="anchor" href="#pytorch"></a>pytorch</h1><p>先澄清一点，pytorch的名字就叫pytorch，但是它在pypi的名字叫torch（没有py前缀）。pytorch在conda的channel名，以及包名（包括pytorch和conda-forge这两个channel下的包）都叫pytorch。</p>
<p>pytorch主要有两种安装方式，分别是通过pip安装和通过conda安装。</p>
<h2><a id="toc-fb4" class="anchor" href="#toc-fb4"></a>通过pip安装</h2><p><a href="https://pytorch.org/">pytorch官网</a>给了非常详细的安装指引，根据平台、CPU/GPU版本的不同，给了不同的pip安装命令。</p>
<p><img src="https://debug.fanzheng.org/static/upload/20260420/upload_af8fb93c7480a4ea930fbef86f1bc3b8.png" alt="image.png"></p>
<p>例如：<code>pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu130</code>。其含义是以download.pytorch.org作为pip源进行安装。</p>
<p>需要使用pytorch自己的pip源安装的核心原因是，其在pypi同名同版本只能有一个包，这就导致只能发布CPU/GPU等多个版本中的一个。指定pip源的方式就可以解决这个问题，不同版本用不同的源地址即可。</p>
<p>但这样也有坏处，各个镜像站基本上都没有针对pytorch的pip源的镜像。</p>
<p>我们知道pypi一般是有镜像的，pytorch在pypi上的包也存在一些特殊处理：</p>
<ul>
<li>Linux: 包是GPU版本的pytorch，并且自带CUDA runtime。例如PyTorch 2.11用CUDA 13.0，PyTorch 2.10用CUDA 12.x。</li>
<li>Windows: 包是CPU版本的pytorch，当然也不会有CUDA runtime。</li>
</ul>
<p>通过pip安装的GPU版本的pytorch，CUDA runtime会安装在<code>miniforge3\envs\${ENV}\Lib\site-packages\torch\lib</code>。</p>
<blockquote>
<p>GPU版本的pytorch安装完后会看到类似于<code>2.11.0+cu130</code>的版本样式，尽管如此，也无法通过<code>pip install torch==2.11.0+cu130</code>这种方式通过pypi源安装，因为pypi源里就没有这种命名方式。</p>
</blockquote>
<p><strong>总结一下，如果是通过pip安装GPU版本的pytorch，Linux在pytorch官方源或pypi（含pypi镜像）均可，Windows只能通过pytorch官方源安装。</strong></p>
<h2><a id="toc-6df" class="anchor" href="#toc-6df"></a>通过conda安装</h2><p><strong>先说最建议的方式</strong>，就是从conda-forge这个channel中安装。</p>
<p>执行<code>conda install pytorch</code>即可安装，会识别显卡驱动自动决定是否安装GPU版。</p>
<blockquote>
<p>要确保是从conda-forge安装的pytorch，如果配置了其他channel，可以通过<code>conda install conda-forge::pytorch</code>显式指定。</p>
</blockquote>
<p>通过conda安装的GPU版本的pytorch，CUDA runtime会安装在<code>miniforge3\envs\${ENV}\Library\bin</code>。</p>
<p>如果想要强制指定安装GPU版本，可以安装<code>conda-forge::pytorch-gpu</code>，<code>pytorch-gpu</code>是个元包，作用就是强制安装pytorch的GPU版。</p>
<p><strong>再说一个广为流传但已经过时的安装方式</strong>，<code>conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia</code>，我们对它拆解一下：</p>
<ul>
<li><code>pytorch</code>、<code>torchvision</code>、<code>torchaudio</code>、<code>pytorch-cuda</code>这几个包都是<code>pytorch</code>这个channel下的包，<code>-c pytorch</code>的作用就是在<code>pytorch</code>这个channel里找这些包</li>
<li><code>pytorch-cuda</code>这个包是个元包，其为<code>nvidia</code>这个channel里CUDA runtime的合集，所以需要<code>-c nvidia</code>才能找到这些CUDA runtime文件才能装这个包，<code>pytorch-cuda=12.4</code>就是在指定安装的CUDA runtime版本</li>
<li><code>pytorch::pytorch</code>只包含pytorch，<code>conda install</code>时带上<code>-c nvidia</code>就会安装GPU版本的pytorch，但是不带CUDA runtime，需要通过<code>pytorch::pytorch-cuda</code>包安装CUDA runtime，最终形成上面那个完整的一条命令</li>
</ul>
<p>为什么说这个安装方式已经过时呢？因为conda的<a href="https://anaconda.org/channels/pytorch">pytorch这个channel</a>上的pytorch相关包早在24年10月底就不再更新（<a href="https://github.com/pytorch/pytorch/issues/138506">官方说明</a>），只在<a href="https://anaconda.org/channels/conda-forge/packages/pytorch/overview"><code>conda-forge</code></a>继续维护。最终版本锁定在了pytorch 2.5.1，python 3.12，cuda 12.4。不过这里说的是pytorch这个包，其他包可能仍在更新。</p>
<p><strong>总结一下，如果是通过conda安装，直接从<code>conda-forge</code>安装pytorch包即可，会自动识别决定是否安装GPU版。不要安装<code>pytorch</code>这个channel里的任何包。</strong></p>
<h2><a id="toc-ff2" class="anchor" href="#toc-ff2"></a>如何选择conda安装还是pip安装</h2><p>conda-forge里的pytorch版本没有pytorch官网（自己的pip源）更新快。</p>
<p><strong>因此，Linux系统上用哪个都可以；但Windows上考虑到是否有GPU版的镜像源的问题，优先考虑conda安装，如果对pytorch新版本有要求，就用pip走官方源安装。</strong></p>
<p><strong>无论选择哪种安装方式，都不需要去<a href="https://developer.nvidia.com/cuda-toolkit-archive">NVIDIA官网下载安装CUDA Toolkit</a>和<a href="https://developer.nvidia.com/cudnn-archive">cuDNN</a>！</strong></p>

            ]]></description>
            <pubDate>Wed, 15 Apr 2026 15:04:55 GMT</pubDate>
            <guid>https://fanzheng.org/post/myth-of-python-and-pytorch.html</guid>
        </item>
        <item>
            <title>一波三折：频繁USB设备断开的IRQL_NOT_LESS_OR_EQUAL蓝屏问题分析与解决</title>
            <link>https://fanzheng.org/post/pin-fan-USB-she-bao-duan-kai-de-IRQL_NOT_LESS_OR_EQUAL-lan-ping-wen-ti-fen-xi-yu-jie-jue.html</link>
            <description><![CDATA[
            <div class="toc"><ul>
<li><a href="#toc-a04">现象</a></li>
<li><a href="#toc-772">排查</a><ul>
<li><a href="#toc-3b9">怀疑主板问题</a></li>
<li><a href="#toc-c65">感觉不太对劲，不一定是主板的问题</a></li>
<li><a href="#toc-69f">先解决蓝屏问题</a></li>
<li><a href="#toc-c6d">为什么插前面板没问题</a></li>
</ul>
</li>
<li><a href="#toc-25f">总结</a></li>
</ul>
</div><h1><a id="toc-a04" class="anchor" href="#toc-a04"></a>现象</h1>
<p>在玩游戏的时候，电脑突然出现了一下USB设备断开的音效，紧接着就蓝屏了。再重启，刚进系统继续蓝屏。再重启，系统启动的主板LOGO转半天才进系统，然后就一直重复响USB设备断开的音效然后过一段时间蓝屏。</p>
<p>打开设备管理器，看到有个USB设备有黄色叹号，枚举了一下设备，确认是无线网卡。但是拔出后系统仍然有频繁USB弹出音效并会导致蓝屏。</p>
<h1><a id="toc-772" class="anchor" href="#toc-772"></a>排查</h1>
<h2><a id="toc-3b9" class="anchor" href="#toc-3b9"></a>怀疑主板问题</h2>
<p>把所有USB设备拔掉，测试了还是有USB弹出音效并蓝屏（后续回想了一下，这里我只把所有有线设备都拔掉了，只留下了一个鼠标的无线接收器）。</p>
<p>考虑到我的主板已经用了很久了，因此怀疑南桥芯片供电之类的不稳。并且第二天早上起床后拆机看了一眼，没有发现有电容鼓包的问题。</p>
<p>考虑到不想买到有暗病的主板，担心还要折腾，因此在最终京东寻觅并购买新主板。</p>
<h2><a id="toc-c65" class="anchor" href="#toc-c65"></a>感觉不太对劲，不一定是主板的问题</h2>
<p>我尝试把所有USB全拔了，发现这下就不USB弹出和蓝屏了。之前全拔的时候，我只把所有有线的拔了，就剩一个鼠标的接收器没拔，一是这个不拔不影响我拆机，二是觉得一个鼠标接收器能有啥问题。</p>
<p>结果情况就是：我把这个接收器插背板的其他USB口上，一样会USB断开然后蓝屏，试了好几个口，2.0 3.0 3.1的口都试了。但是我插到前面板上就没问题了。</p>
<h2><a id="toc-69f" class="anchor" href="#toc-69f"></a>先解决蓝屏问题</h2>
<p>我想到这次蓝屏每次都是一样的代码IRQL_NOT_LESS_OR_EQUAL，而且这次我其实没有去看蓝屏分析。我就把蓝屏dump文件拿去分析了一下，发现每次都是一个叫<code>PECKP_x64.SYS</code>的驱动文件导致的（签名企业是<code>Client Server International. Inc. Beijing Branch</code>）。</p>
<p><img src="https://debug.fanzheng.org/static/upload/20260314/upload_df4b90d63a53004e2aa11abb36ff9a14.png" alt="PixPin_2026-03-14_16-37-00.jpg"></p>
<p><img src="https://debug.fanzheng.org/static/upload/20260314/upload_da03eaf650ccd4589e217344e56ddb1c.png" alt="PixPin_2026-03-14_16-45-25.jpg"></p>
<p>然后我就去找，结果发现是个U盾的驱动，用来提供虚拟键盘能力的，估计是在USB这里做了一些操作。在频繁USB设备退出时可能有BUG，导致蓝屏。关键之前我已经把所有这种东西全卸载了，结果还有残留。</p>
<p>首先尝试使用ProcessExplorer搜索进程看看是哪个进程在占用该文件，结果没找到。于是在注册表的services中搜索，发现<code>计算机\HKEY_LOCAL_MACHINE\SYSTEM\Setup\FirstBoot\Services\PECKbdProtector</code>下有这个内核态服务，执行<code>sc qc PECKbdProtector</code>发现确实存在。</p>
<p>接着去安全模式下，执行<code>sc delete PECKbdProtector</code>删除服务，然后就可以正常删掉<code>PECKP_x64.SYS</code>文件了。</p>
<p>此时蓝屏问题已彻底解决。现在的情况是，只要鼠标插后面板，就会频繁USB设备退出，但绝对不会蓝屏了！</p>
<p>PS: 我还在系统中找了一下我安装的网银文件（中国银行和农行的），找到以下目录，全给删掉了：</p>
<pre><code class="hljs lang-undefined">&quot;C:\Windows\System32\drivers\PECKP_x64.SYS&quot;
&quot;C:\Windows\System32\CryptoKit.BOC.x64.dll&quot;
&quot;C:\Windows\SysWOW64\CryptoKit.BOC.x86.dll&quot;
&quot;C:\Windows\SysWOW64\BOCControl\CryptoKitHost.BOC.x86.exe&quot;
&quot;C:\Windows\SysWOW64\BOCControl\npCryptoKit.BOC.x86.exe&quot;
&quot;C:\Windows\SysWOW64\ES_BOCToken.x86.dll&quot;
&quot;C:\Windows\SysWOW64\FT_BOCToken.x86.dll&quot;
&quot;C:\Windows\SysWOW64\HB_BOCToken.x86.dll&quot;
&quot;C:\Windows\SysWOW64\TDR_BOCToken.x86.dll&quot;
&quot;C:\Windows\SysWOW64\WD_BOCToken.x86.dll&quot;

以及
&quot;C:\Program Files (x86)\ABC IBS Security Suite 2.3\PowerEnterABC_x64.ocx&quot;
</code></pre>
<p>以后只在虚拟机里用网银和装这些东西。</p>
<h2><a id="toc-c6d" class="anchor" href="#toc-c6d"></a>为什么插前面板没问题</h2>
<p>我联想到插前面板没问题，所以我又尝试了一下，用在后面板相同的口上，用USB延长线延长出来，再插接收器，结果一点问题没有！</p>
<p>问了下豆包，说有可能是2.4G频段干扰导致的：</p>
<p><img src="https://debug.fanzheng.org/static/upload/20260314/upload_ce2021f0738c77db130c955c7130879e.png" alt=""></p>
<p>确实有可能是干扰问题，但是之前也没遇到这个问题啊，也太神奇了。</p>
<p>WXC说，是不是隔壁整了个大功率2.4干扰仪，我无线网卡一直走的5G，所以没感觉到。确实不排除这种可能啊！</p>
<h1><a id="toc-25f" class="anchor" href="#toc-25f"></a>总结</h1>
<p>本次蓝屏，为鼠标USB无线接收器频繁断开，诱发了系统中残留的U盾驱动的BUG导致。至于鼠标USB无线接收器频繁断开，可能是接收器自身体质有问题，在受到了一些扰动时会触发USB断开。这种扰动可能是外界的（例如2.4G频段干扰），也可能来自机箱内部。</p>
<p>具体原因目前仍不得而知，但USB接收器大概率是有问题的。结合我<a href="https://debug.fanzheng.org/post/solve-the-problem-of-IRQL_NOT_LESS_OR_EQUAL-blue-screen-caused-by-Razer-mouse-driver.html">之前经历的蓝屏问题</a>，可以更加确信这一点。当时的蓝屏肯定也是因为这个U盾驱动导致的，但是USB接收器插在底座上应该也是会触发USB断开，跟这两天遇到的这个问题估计是一样的，接收器大概率有问题。</p>
<blockquote>
<p>2026-03-15 16:43:51 UPDATE：现在鼠标接收器插前面板也会出现USB断开的情况了，基本实锤确实是鼠标的问题。</p>
</blockquote>
<blockquote>
<p>2026-03-15 23:25:33 UPDATE：去雷蛇官网查了一下，它在<a href="https://mysupport-chsi.razer.com/app/answers/detail/a_id/11254">2023.12.22有个固件更新（1.06-&gt;1.07）</a>，下载更新程序把鼠标和接收器的固件都更新一下，用了一个小时，不再有任何USB断开的情况出现。</p>
<p><img src="https://debug.fanzheng.org/static/upload/20260315/upload_75b42075ee629360b8694d18f53f037d.png" alt="PixPin_2026-03-15_21-45-04.jpg"></p>
</blockquote>
<blockquote>
<p>2026-03-16 23:32:41 UPDATE：又出现一样的情况了，感觉必须得换鼠标了。</p>
</blockquote>
<blockquote>
<p>2026-03-18 22:46:09 UPDATE：找客服提供了另一个方案，“另外您也可以尝试重新配对接收器：您可以使用配对实用程序v1.00.06_r1：<a href="https://rzr.to/34dvl2">https://rzr.to/34dvl2</a>”。再试一下看看。</p>
</blockquote>

            ]]></description>
            <pubDate>Sat, 14 Mar 2026 14:59:20 GMT</pubDate>
            <guid>https://fanzheng.org/post/pin-fan-USB-she-bao-duan-kai-de-IRQL_NOT_LESS_OR_EQUAL-lan-ping-wen-ti-fen-xi-yu-jie-jue.html</guid>
        </item>
    </channel>
</rss>
