Deployed 2536c93 with MkDocs version: 1.6.1

This commit is contained in:
2026-05-03 11:47:30 +08:00
commit 1ff86b66fc
418 changed files with 617336 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
<svg width="700" height="320" xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="lstm-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
<path d="M0,0 L8,3 L0,6" fill="none" stroke="#555" stroke-width="1"/>
</marker>
</defs>
<text x="350" y="22" fill="#333" font-size="14" font-weight="bold" text-anchor="middle">LSTM Cell: Gates Control Information Flow</text>
<!-- Cell state highway (top) -->
<line x1="60" y1="70" x2="640" y2="70" stroke="#9b59b6" stroke-width="3" marker-end="url(#lstm-arrow)"/>
<text x="350" y="55" fill="#9b59b6" font-size="11" font-weight="bold" text-anchor="middle">Cell state c_t (long-term memory)</text>
<!-- Hidden state (bottom) -->
<line x1="60" y1="250" x2="640" y2="250" stroke="#3498db" stroke-width="2.5" marker-end="url(#lstm-arrow)"/>
<text x="350" y="285" fill="#3498db" font-size="11" font-weight="bold" text-anchor="middle">Hidden state h_t (short-term output)</text>
<!-- Input labels -->
<text x="40" y="74" fill="#9b59b6" font-size="10" text-anchor="end">c_{t-1}</text>
<text x="40" y="254" fill="#3498db" font-size="10" text-anchor="end">h_{t-1}</text>
<text x="660" y="74" fill="#9b59b6" font-size="10">c_t</text>
<text x="660" y="254" fill="#3498db" font-size="10">h_t</text>
<!-- Input x_t -->
<line x1="350" y1="310" x2="350" y2="270" stroke="#555" stroke-width="1.2" marker-end="url(#lstm-arrow)"/>
<text x="350" y="318" fill="#666" font-size="10" text-anchor="middle">x_t (input)</text>
<!-- === Forget Gate === -->
<circle cx="180" cy="70" r="12" fill="white" stroke="#e74c3c" stroke-width="2"/>
<text x="180" y="75" fill="#e74c3c" font-size="12" text-anchor="middle" font-weight="bold">x</text>
<text x="180" y="110" fill="#e74c3c" font-size="10" text-anchor="middle" font-weight="bold">Forget</text>
<text x="180" y="123" fill="#e74c3c" font-size="10" text-anchor="middle">Gate</text>
<!-- Forget gate sigmoid -->
<rect x="155" y="135" width="50" height="24" rx="4" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1"/>
<text x="180" y="151" fill="#e74c3c" font-size="10" text-anchor="middle">sigma</text>
<line x1="180" y1="135" x2="180" y2="82" stroke="#e74c3c" stroke-width="1.2" marker-end="url(#lstm-arrow)"/>
<!-- Connection from h and x to forget gate -->
<line x1="180" y1="250" x2="180" y2="159" stroke="#555" stroke-width="1" stroke-dasharray="3,2"/>
<!-- === Input Gate === -->
<circle cx="300" cy="70" r="12" fill="white" stroke="#27ae60" stroke-width="2"/>
<text x="300" y="75" fill="#27ae60" font-size="12" text-anchor="middle" font-weight="bold">+</text>
<text x="300" y="110" fill="#27ae60" font-size="10" text-anchor="middle" font-weight="bold">Input</text>
<text x="300" y="123" fill="#27ae60" font-size="10" text-anchor="middle">Gate</text>
<!-- Input gate sigma -->
<rect x="265" y="135" width="30" height="24" rx="4" fill="#27ae60" opacity="0.15" stroke="#27ae60" stroke-width="1"/>
<text x="280" y="151" fill="#27ae60" font-size="9" text-anchor="middle">sigma</text>
<!-- Candidate tanh -->
<rect x="305" y="135" width="30" height="24" rx="4" fill="#f39c12" opacity="0.15" stroke="#f39c12" stroke-width="1"/>
<text x="320" y="151" fill="#f39c12" font-size="9" text-anchor="middle">tanh</text>
<!-- sigma * tanh = new info -->
<line x1="300" y1="135" x2="300" y2="82" stroke="#27ae60" stroke-width="1.2" marker-end="url(#lstm-arrow)"/>
<line x1="300" y1="250" x2="300" y2="159" stroke="#555" stroke-width="1" stroke-dasharray="3,2"/>
<!-- === Output Gate === -->
<circle cx="480" cy="250" r="12" fill="white" stroke="#3498db" stroke-width="2"/>
<text x="480" y="255" fill="#3498db" font-size="12" text-anchor="middle" font-weight="bold">x</text>
<text x="480" y="210" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">Output</text>
<text x="480" y="223" fill="#3498db" font-size="10" text-anchor="middle">Gate</text>
<!-- Output gate sigma -->
<rect x="420" y="170" width="50" height="24" rx="4" fill="#3498db" opacity="0.15" stroke="#3498db" stroke-width="1"/>
<text x="445" y="186" fill="#3498db" font-size="10" text-anchor="middle">sigma</text>
<line x1="445" y1="194" x2="468" y2="242" stroke="#3498db" stroke-width="1.2" marker-end="url(#lstm-arrow)"/>
<!-- tanh of cell state to output -->
<rect x="502" y="135" width="36" height="24" rx="4" fill="#f39c12" opacity="0.15" stroke="#f39c12" stroke-width="1"/>
<text x="520" y="151" fill="#f39c12" font-size="9" text-anchor="middle">tanh</text>
<line x1="520" y1="70" x2="520" y2="135" stroke="#9b59b6" stroke-width="1" stroke-dasharray="3,2"/>
<line x1="520" y1="159" x2="492" y2="242" stroke="#f39c12" stroke-width="1.2" marker-end="url(#lstm-arrow)"/>
<!-- Summary box -->
<rect x="80" y="292" width="540" height="22" rx="6" fill="#f5f5f5" stroke="#333" stroke-width="1"/>
<text x="350" y="307" fill="#333" font-size="10" text-anchor="middle">Forget gate: what to erase | Input gate: what to write | Output gate: what to expose</text>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB