# PyTorch 剖析系列（二）：从 nn.Linear 到融合 MLP

- 来源：Hugging Face：Blog（RSS）
- 发布时间：2026-06-11 08:00
- AIHOT 分数：46
- AIHOT 链接：https://aihot.virxact.com/items/cmq9dxsg50b10slldf6ff6khs
- 原文链接：https://huggingface.co/blog/torch-mlp-fusion

## AI 摘要

本部分将手写 matmul-add 对替换为 nn.Linear（bias=True），堆叠三层 Linear 与激活函数构成多层感知机（MLP）块，在 NVIDIA A100 GPU 上剖析。Profile trace 显示 nn.Linear 内部调用 aten::addmm，将 bias 加法作为 epilogue 融合进矩阵乘法核，避免额外 HBM 访问；transpose 操作（aten::t）仅改写 CPU 端张量元数据（shape 和 stride），不启动 GPU 核。

## 正文

这是一则列表来源，站内未收录完整正文。
