{"slug": "profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp", "title": "Profiling in PyTorch (Part 2): From nn.Linear to a Fused MLP", "summary": "PyTorch's `nn.Linear` module transposes its weight tensor before performing matrix multiplication and addition, as revealed by profiler traces showing an `aten::t` operation that only modifies tensor metadata on the CPU without launching a GPU kernel. The bias addition is folded into a single `aten::addmm` kernel rather than appearing as separate multiplication and addition operations, demonstrating how PyTorch optimizes the linear layer's forward pass. This profiling analysis builds on Part 1's examination of manual matmul-add pairs to show how the framework's module-level abstractions handle these operations internally.", "body_md": "Updated • 62 • 1\n\n# Profiling in PyTorch (Part 2): From nn.Linear to a Fused MLP\n\n[Update on GitHub](https://github.com/huggingface/blog/blob/main/torch-mlp-fusion.md)\n\nIn the [first part of this series \"Profiling in PyTorch\"](https://huggingface.co/blog/torch-profiler), we used `torch.add(torch.matmul(x, w), b)`\n\nto learn how to read PyTorch profiler traces. We also discussed several other topics that came our way - the CPU dispatch chain, launch overhead, the difference between an overhead-bound and a compute-bound regime, and some internals of `torch.compile`\n\n.\n\nIn the second iteration (this blog post), we climb one rung up the ladder. We replace the hand-written matmul-add pair with an `nn.Linear`\n\n(with `bias=True`\n\n). This is the building block every deep learning model uses. We then stack three of them (specific to our example), with an activation in between, to form a Multilayer Perceptron (MLP) block.\n\nThe scripts for this blog post live here:\n\n[,]`02_linear.py`\n\n[, and]`03_simple_mlp.py`\n\n[. Like before, it helps to open them in a separate tab and walk through the code as you read. We use an]`03_kernels_mlp.py`\n\n`NVIDIA A100-SXM4-80GB`\n\nGPU to run the scripts. It is really easy to set up a GPU on the Hugging Face infrastructure and experiment with the scripts using[Dev Mode with Spaces]. One could also run the scripts with the[Hugging Face Jobs pipeline].\n\nBefore we begin, a quick recap of two ideas we will lean on repeatedly:\n\n- A GPU\n**kernel** is a program that runs in parallel on many threads of the GPU. - The CPU\n**schedules and launches** these kernels. Most of the PyTorch overhead you see in a profiler trace is this scheduling work.\n\n## From matmul-add to Linear\n\n`nn.Linear`\n\nis a module wrapper around the same matrix multiplication and addition we already profiled in [Part 1](https://huggingface.co/blog/torch-profiler). The only difference is that it owns its weight and bias as parameters and exposes a `forward`\n\nmethod that PyTorch users have grown familiar with.\n\n```\n# bias=True would truly emulate the multiplication and addition\n# operations we have seen in part 1 of the series\nlinear_layer = nn.Linear(in_dim, out_dim, bias=True)\ny = linear_layer(x)\n```\n\nThe operation at hand can be written as:\n\n```\ny = x @ w.T + b\n```\n\nWhere `x`\n\nis the input, `w`\n\nis the weight and `b`\n\nis the bias. Let's run [ 02_linear.py](https://huggingface.co/datasets/ariG23498/profiling-pytorch/blob/main/02_linear.py) and check the profile.\n\n```\nuv run 02_linear.py --batch 1024 --in_dim 32 --out_dim 64\nuvx trace-util traces -b traces\n```\n\n[is a utility that will sync your traces to a]`trace-util`\n\n[Hugging Face bucket]and then provide the[Preffeto URLs]on your terminal.\n\nFigure 1 shows the profiler trace of a forward call of the linear layer. We trace the `forward`\n\ncall of the linear layer with a similar `schedule`\n\nsetup as the previous traces, with `wait=1`\n\n, `warmup=1`\n\nand `active=3`\n\n. This is why we see three Profile Steps in the CPU and GPU lanes.\n\n### What is the transpose doing?\n\nIf we zoom into the profiler trace, as we do in Figure 2, we notice an `aten::t`\n\n(transpose) op before the `aten::addmm`\n\n(multiplication and addition) op. We can already figure out that `nn.Linear`\n\ntransposes the weight parameter and then multiplies it with the input. This is the reason we see an `aten::t`\n\nop.\n\nAn important thing to notice is that `aten::t`\n\ndoes not really copy or reorganize data: it only rewrites tensor metadata (shape and stride) on the CPU to represent the transposed matrix. It does not launch a kernel on the GPU. One can verify this two ways: by looking at the GPU lane in the trace, or by checking the `aten::t`\n\nrow in the profiler table and the time it took on CUDA.\n\n### Why are there no separate `mul`\n\nand `add`\n\nkernels?\n\nThere is no `aten::add`\n\n(the bias addition) in the dispatch chain of the linear layer, as seen in Figure 3. This is because the bias addition has been *folded* into the matrix multiplication kernel, using what is called an **epilogue**.\n\nAn **epilogue** is a small computation that a GEMM (GEneral Matrix Multiply) kernel does at the very end, just before it writes its result back to HBM (High Bandwidth Memory, the GPU's main memory). Adding a bias, applying an activation, or scaling by a constant are all classic epilogues. The point of an epilogue is to avoid loading or writing to HBM a second time, since memory traffic makes an operation expensive.\n\n`nn.Linear`\n\ncalls `torch.nn.functional.linear`\n\n, which, in turn, calls `aten::linear`\n\n. `aten::linear`\n\nlooks at the inputs, notices that a bias was passed, and dispatches `aten::addmm(bias, x, weight)`\n\ninstead of doing a matmul and an add separately. `addmm`\n\ncomputes:\n\n```\nout = x @ weight.T + bias\n```\n\nThe cuBLAS GEMM kernel that runs on the GPU has a bias-add variant built in, and that's the kernel `aten::addmm`\n\npicks. The add never appears as a separate kernel because it is **part of the matmul kernel's writeback**, which is exactly what an epilogue is.\n\nThis is the moment to notice something subtle. The kernel you saw in [Part 1 under --compile](https://huggingface.co/blog/torch-profiler#did-we-fuse-the-matmul-and-add-kernels-into-one) (\n\n`addmm`\n\n) is the kernel that eager `nn.Linear`\n\nalready uses. There is nothing left for `torch.compile`\n\nto fuse here, which is the next thing we will verify.###\n\nCan --compile help a single Linear?\n\nLet's compile the forward call and look at the profiler trace. (The profiler trace is visualized in the [next section](#where-did-the-transpose-go-kernel-layouts-and-pre-ops))\n\n```\nuv run 02_linear.py --batch 1024 --in_dim 32 --out_dim 64 --compile\nuvx trace-util traces -b traces\n```\n\nIf you compare the eager and compiled traces for a single `nn.Linear`\n\n's `forward`\n\n, you will find:\n\n- The same cuBLAS GEMM kernel on the GPU.\n- The same\n`aten::addmm`\n\nop on the CPU. - A few extra rows on the CPU lane unique to compile.\n\nThis is worth internalizing. A common reflex is to reach for `torch.compile`\n\nwhenever a model feels slow. For a single GEMM-with-bias, compile has very little to do. This is not a bug, this is just that compile needs more than one operation to possibly do any fusing. Let's prove that by [looking at an MLP](#stacking-two-linears-the-mlp).\n\n### Where did the transpose go? Kernel layouts and pre-ops\n\nA careful reader of the two traces (eager vs compile) will notice that the eager CPU dispatch chain has more in it than the compiled one.\n\nFigure 4: Eager dispatch chain where `aten::linear` walks through `aten::t` (transpose) and then `aten::addmm` |\n\nThe eager CPU dispatch chain inside `aten::linear`\n\nis `aten::t`\n\nfollowed by `aten::addmm`\n\n(Figure 4). To understand what `aten::t`\n\nactually does, we need a quick detour into *strides* and *views*.\n\nA tensor stores its data as one flat, contiguous run of numbers in memory. The `shape`\n\nand `stride`\n\nare metadata that sit on top of that run and tell PyTorch how to walk it: a stride of `(s0, s1)`\n\nmeans \"step `s0`\n\nelements to move one row, step `s1`\n\nto move one column\". Change the metadata and you get a different *view* of the *same* raw data, with no copy:\n\n```\n>>> M = torch.tensor([[0, 1],\n...                   [2, 3],\n...                   [4, 5]])\n>>> M.shape, M.stride()\n(torch.Size([3, 2]), (2, 1))   # two steps per row, one step per column\n\n>>> T = M.t()                  # transpose\n>>> T.shape, T.stride()\n(torch.Size([2, 3]), (1, 2))   # shape and stride swapped, data untouched\n>>> T\ntensor([[0, 2, 4],\n        [1, 3, 5]])\n>>> T.flatten()                # forced to materialize, so the data is reordered\ntensor([0, 2, 4, 1, 3, 5])\n```\n\n`M.t()`\n\ndid not move a single number. It returned a new view whose strides are swapped, so reading it row-by-row now walks the original buffer `0, 1, 2, 3, 4, 5`\n\nin transposed order. The underlying data is identical; only the metadata differs.\n\nThis is exactly what `aten::t`\n\ndoes inside the linear layer: it does not allocate a new tensor or copy any data, it produces a *view* of the weight with rewritten strides.\n\nAs we can see in Figure 5, compile did not remove a GPU kernel: it removed the *CPU overhead* of dispatching that view. Inductor traced through the view chain at compile time, computed the resulting strides once, and emitted a direct `aten::addmm`\n\ncall with those strides hard-coded. A few microseconds of CPU work disappear while the GPU does identical math.\n\nAs one would expect, when the input data violates the strides precomputed by the compiler, it will throw an error.\n\nIf you look at the GPU lane in both traces, there is exactly one kernel per forward, and it is the *same* kernel both times:\n\n```\ncutlass_80_wmma_tensorop_bf16_s161616gemm_bf16_32x32_32x1_tn_align8\n```\n\nIf no transpose kernel ran, who taught the GEMM to read the weight matrix in transposed order? The answer is in the kernel's name. Look at the suffix:\n\n```\ncutlass_80_wmma_tensorop_bf16_s161616gemm_bf16_32x32_32x1_tn_align8\n                                                          ^^\n```\n\nThat `tn`\n\nis the layout descriptor. cuBLAS and CUTLASS precompile a *separate kernel binary* for each combination of input layouts.\n\n`n`\n\n(non-transposed) and `t`\n\n(transposed) describe how a kernel walks its input during the inner loop. The dispatcher's job is to look at the input strides, decide which suffix combination matches, and pick the right precompiled kernel.\n\nThe kernel name in a profiler trace is a hash dump of the kernel's identity. If two runs show the same kernel name, the GPU is doing the same work. If they differ (e.g.,\n\n`_tn_`\n\nvs`_nn_`\n\n,`bf16`\n\nvs`fp16`\n\n, or`s16816gemm`\n\nvs`s161616gemm`\n\n) then the GPU is doing different work, and the dispatcher took a different branch. Learning to read this name is one of the most useful habits when comparing traces.\n\n## Stacking three Linears: the MLP\n\nIn this section, we will profile a Multilayer Perceptron (MLP). To make this more interesting, we will profile a feed-forward network with the GeGLU activation variant (which is quite heavily used in practice). This is also our way of paying tribute to one of the greatest lines ever written in the history of deep learning research (Figure 6).\n\n| Figure 6: The conclusion section of the\n|\n\n``` python\nclass SimpleGeGLUMLP(nn.Module):\n    def __init__(self, dim, hidden):\n        super().__init__()\n        self.gate_proj = nn.Linear(dim, hidden, bias=False)\n        self.up_proj = nn.Linear(dim, hidden, bias=False)\n        self.down_proj = nn.Linear(hidden, dim, bias=False)\n\n    def forward(self, x):\n        g = self.gate_proj(x)\n        u = self.up_proj(x)\n        h = F.gelu(g, approximate=\"tanh\")\n        m = h * u\n        y = self.down_proj(m)\n        return y\n```\n\nYou will find the entire script here: [ 03_simple_mlp.py](https://huggingface.co/datasets/ariG23498/profiling-pytorch/blob/main/03_simple_mlp.py). Execute it like so:\n\n```\nuv run 03_simple_mlp.py --batch 64 --seq 128 --dim 768 --hidden 3072\nuvx trace-util traces -b traces\n```\n\nBefore we open the trace, let's think together about what we should expect to see. The `forward`\n\nfunction does a fair amount of computation, but most of it is already familiar to us.\n\nWe should expect three `aten::linear`\n\ndispatches, one for each `nn.Linear`\n\nlayer. We should also expect two pointwise kernel launches, one for the GeLU and one for the multiplication. Forming this expectation before looking is the single most useful habit in the profiling journey: you read the trace to *confirm or break* a guess, not to form one from scratch.\n\nFrom Figure 7 we can pat ourselves on the back, as our intuition was correct. Per forward pass (one `mlp_fwd`\n\n), the GPU runs exactly 5 kernels. Figure 8 highlights the \"occupancy query\" as seen in the CPU lane for the linear projection layers.\n\n| Op | CPU op | GPU kernel | launches |\n|---|---|---|---|\n`gate_proj` |\n`aten::linear` |\n`ampere_bf16_s16816gemm_bf16_128x128_...` |\noccupancy query + cudaLaunchKernel |\n`up_proj` |\n`aten::linear` |\n`ampere_bf16_s16816gemm_bf16_128x128_...` |\noccupancy query + cudaLaunchKernel |\n`gelu` |\n`aten::gelu` |\n`vectorized_elementwise_kernel<4, GeluCUDAKernelImpl...>` |\ncudaLaunchKernel |\n`h * u` |\n`aten::mul` |\n`vectorized_elementwise_kernel<4, ...MulFunctor...>` |\ncudaLaunchKernel |\n`down_proj` |\n`aten::linear` |\n`ampere_bf16_s16816gemm_bf16_128x256_...` |\noccupancy query + cudaLaunchKernel |\n\nThe three GEMMs each do an extra `cudaOccupancyMaxActiveBlocksPerMultiprocessor`\n\ncall before the launch. We have a separate section on this in Part 1, [you can find it here](https://huggingface.co/blog/torch-profiler#why-does-matmul-have-an-extra-cuda-runtime-call). That is cuBLAS sizing the grid. The pointwise ops (GeLU and mul) launch directly, with no occupancy query. So \"a linear\" is actually query + launch, while \"a pointwise op\" is just launch.\n\nThe `aten::t`\n\n, `aten::transpose`\n\n, `aten::reshape`\n\n, `aten::view`\n\n, `aten::as_strided`\n\n, and `aten::_unsafe_view`\n\nops launch zero kernels. They show `0.000us`\n\nof CUDA time in the table (Figure 9) because they only rewrite tensor metadata (shape and stride) on the CPU. A reader scanning the table sees around six op names per linear, but only one of them (`mm`\n\n) ever reaches the GPU.\n\n### Why are there two types of GEMM kernels?\n\nThe MLP flattens `[batch, seq, dim]`\n\nto `[batch * seq, dim]`\n\nfor the matmul. In our command-line invocation we used 64 for `batch`\n\nand 128 for `seq`\n\n, so that's where the `8192`\n\n(`batch * seq = 64 * 128`\n\n) below comes from.\n\nFrom the trace:\n\n| Linear | `aten::mm` input dims |\nM·K·N | cuBLAS kernel | avg CUDA |\n|---|---|---|---|---|\n`gate_proj` |\n`[8192,768] x [768,3072]` |\n`8192·768·3072` |\n`…128x128…stages_32x5_tn` |\n0.19ms |\n`up_proj` |\n`[8192,768] x [768,3072]` |\n`8192·768·3072` |\n`…128x128…stages_32x5_tn` |\n0.19ms |\n`down_proj` |\n`[8192,3072] x [3072,768]` |\n`8192·3072·768` |\n`…128x256…stages_64x3_tn` |\n0.17ms |\n\nAll three GEMMs have the same FLOP count, `2·8192·768·3072 ≈ 38.7 GFLOP`\n\neach, yet `down_proj`\n\nis about `10%`\n\nfaster. Same work, different shape (`N=768`\n\ninstead of `3072`\n\n), so cuBLAS picks a different tile (`128×256`\n\n, with a deeper `stages_64x3`\n\npipeline) that gets better reuse for that shape.\n\nIf you want to learn more about tiling in depth,\n\n[here is a great resource]to get started with.\n\nThis is exactly why the table had two GEMM rows (Figure 9): the `128x128`\n\nrow is gate+up and the `128x256`\n\nrow is down.\n\n### What does `torch.compile`\n\ndo?\n\nBefore compiling the `forward`\n\nmethod and visualizing it, let's do the mental exercise again of asking ourselves what we expect to see in the trace. This is a fun experiment, and an important one to repeat every time you profile something yourself. Always build on your intuition, and the moment something does not match, stop and figure out why.\n\n```\nuv run 03_simple_mlp.py --batch 64 --seq 128 --dim 768 --hidden 3072 --compile\nuvx trace-util traces -b traces\n```\n\nIn eager mode, each `nn.Linear`\n\nwas expanded into a chain of dispatcher ops (`aten::linear`\n\n→ `aten::t`\n\n→ `aten::transpose`\n\n→ `aten::matmul`\n\n→ `aten::reshape`\n\n→ `aten::mm`\n\n). Those are the high-level wrappers that ATen walks through before reaching the real GEMM. `torch.compile`\n\nremoves that chain.\n\nBy the time the compiled graph runs, there is no linear, no matmul, no transpose or reshape and those metadata ops were folded into how `mm`\n\nis called. We can see three bare `aten::mm`\n\nexternal calls (Figure 10). The proof that it is the same GEMM is that the kernel names are byte-for-byte identical to eager: `...128x128...stages_32x5_tn`\n\nfor gate and up, and `...128x256...stages_64x3_tn`\n\nfor down.\n\n### The fused Triton kernel\n\nThis is the headline of the whole compile lesson. The two eager pointwise kernels (GeLU and mul) plus a reshape collapsed into one kernel, `triton_poi_fused__unsafe_view_gelu_mul_0`\n\n(Figure 11). Let's decode the name:\n\n`triton`\n\n: generated by Inductor's Triton backend (not cuBLAS, not ATen).`poi`\n\n: pointwise (Inductor tags pointwise kernels`poi`\n\n, reductions`red`\n\n, and persistent reductions`per`\n\n).`fused__unsafe_view_gelu_mul`\n\n: the ops it merged: the`_unsafe_view`\n\n(reshape), the GeLU, and the mul.`0`\n\n: the unique id within the graph.\n\nWhy is this a win? In eager mode, the intermediate `h = gelu(g)`\n\nis a full `[8192, 3072]`\n\nbf16 tensor (around 50 MB) that the GeLU kernel writes to HBM and the mul kernel immediately reads back. Fusion keeps it in registers (memory that resides inside the chip and are closer than the HBM). The Triton kernel reads `g`\n\nand `u`\n\nonce, computes `gelu(g) * u`\n\n, and writes the result once. One whole round trip of the intermediate through global memory is gone.\n\n## Let's use hand tuned kernels\n\nSo far we have let PyTorch (eager) and the compiler (`torch.compile`\n\n) pick our kernels. Now we plug in a kernel that a human expert wrote and tuned by hand. We use the `LigerGEGLUMLP`\n\nlayer, that we can easily fetch from the [Hugging Face Hub](https://huggingface.co/kernels/kernels-community/liger-kernels) with the `kernels`\n\nlibrary.\n\n``` python\nfrom kernels import get_kernel\n\nkernels_layers = get_kernel(\"kernels-community/liger-kernels\", version=1).layers\nkernels_geglu_mlp = kernels_layers.LigerGEGLUMLP(Config()).to(device, dtype=torch.bfloat16).eval()\n```\n\nThe full script is here: [ 03_kernels_mlp.py](https://huggingface.co/datasets/ariG23498/profiling-pytorch/blob/main/03_kernels_mlp.py).\n\n```\nuv run 03_kernels_mlp.py --batch 64 --seq 128 --dim 768 --hidden 3072\nuvx trace-util traces -b traces\n```\n\nFigure 12 shows the profile for the `LigerGEGLUMLP`\n\nlayer using the Liger kernels from the Hub.\n\n### Why use the kernels library\n\nWriting kernels in Triton or CUDA is one problem and *shipping* them is another. The kernel has to be compiled for your exact combination of GPU architecture, CUDA version, and PyTorch version. This is the step that usually breaks (\"works on my machine\", missing `nvcc`\n\n, wrong Triton version).\n\nThe [ kernels](https://github.com/huggingface/kernels) library moves that build step off your machine.\n\n`get_kernel(\"kernels-community/liger-kernels\", version=1)`\n\ndownloads a **pre-built, version-pinned** kernel package from the Hugging Face Hub and caches it locally (here under\n\n`~/.cache/...kernels-community--liger-kernels`\n\n). The benefits are:- The kernels are compiled once, in CI, for many architectures and version combinations. You download the right binary instead of compiling it yourself.\n`version=1`\n\npins the exact build, so everyone running your script gets the same kernel. There is no \"it got slower after I updated a package\".- The package exposes a\n`.layers`\n\nattribute with drop-in`nn.Module`\n\ns (like`LigerGEGLUMLP`\n\n). You swap your module for theirs and nothing else in your model changes.\n\n### Why tuned kernels are better\n\nWhen we say \"tuned\", we mean two concrete things, and both are visible in the trace.\n\n**The fusion is baked in.** Theforward is`LigerGEGLUMLP`\n\n`down_proj(LigerGELUMulFunction.apply(gate_proj(x), up_proj(x)))`\n\n. Theruns a single Triton kernel,`LigerGELUMulFunction`\n\n, that computes`_geglu_tanh_forward_kernel`\n\n`gelu(gate) * up`\n\nin one pass. This is exactly what we saw from`torch.compile`\n\n, where the intermediate never makes a round-trip through HBM. We get it here**without the compiler**, as shown in Figures 13 and 14 (no Dynamo guards, no compile latency, no recompilation risk).** The launch parameters were chosen for the hardware.**The kernel does not guess its block size at random. Liger'spicks them from the column count.`calculate_settings`\n\nIt is worth being honest about the trade-off here, because the raw numbers can be misleading. The Liger kernel runs in **92.8 µs**, while Inductor's fused kernel from the compile run was **89.4 µs**. At first glance the hand-written kernel looks slightly slower, but that comparison hides the cost that makes it worthwhile.\n\n`torch.compile`\n\nspecializes for a **static shape**. Inductor's `89.4 µs`\n\nkernel is fast precisely because it was generated for *this exact* `[8192, 3072]`\n\nproblem. Change the batch size, the sequence length, or the hidden dimension, Dynamo re-traces, and you pay the compile cost all over again to get a new specialized kernel.\n\nSo the real choice is not \"slow human kernel vs fast compiled kernel\". It is **a fast generic kernel vs a kernel specialized for one particular input shape**. The Liger kernel takes one set of launch parameters and runs them for *any* shape with no recompilation. It gives up the last few microseconds that per-shape specialization would buy, in exchange for being robust to changing shapes.\n\n## Conclusion\n\nThe table below collects what each step changed on the GPU and what it left untouched.\n\n| Setup | What changed | What stayed the same |\n|---|---|---|\nEager `nn.Linear` |\nBaseline: bias add is already folded into the GEMM epilogue (`addmm` ), so it is one cuBLAS kernel, not a matmul plus an add |\n— |\nCompiled `nn.Linear` |\nA few CPU dispatch ops (the `aten::t` view bookkeeping) disappear |\nSame single cuBLAS GEMM kernel, byte-for-byte. Compile has nothing to fuse |\n| Eager MLP | 5 GPU kernels: 3 GEMMs + a GeLU + a mul. The `[8192, 3072]` intermediate makes a full round-trip through HBM |\nEach GEMM is still the same bias-free cuBLAS kernel as a standalone linear |\n| Compiled MLP | GeLU + mul + reshape collapse into one fused Triton kernel; the intermediate stays in registers. Pays compile pre-ops (Dynamo, guards) |\nThe 3 GEMMs are untouched with identical cuBLAS kernel names |\n| Liger MLP | Same fusion, but baked into a hand-written Triton kernel with hardware-tuned launch params with no Dynamo, guards, or compile latency |\nThe 3 GEMMs are still the same cuBLAS kernels |\n\nIf there is one habit to carry forward, it is the one we practiced before every trace: **guess first, then look.** State what you expect the trace to contain, open it, and treat any mismatch as the most interesting thing on the screen.\n\nThis was the second stop in the **Profiling in PyTorch** series. In the next post we will keep climbing the ladder, moving from this MLP block towards the attention block and, eventually, a full model.\n\nThanks to [Noe Flandre](https://huggingface.co/NoeFlandre) and [Pedro Gabriel Gengo Lourenço](https://huggingface.co/pedrogengo) for their reviews on the early draft of the post!", "url": "https://wpnews.pro/news/profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp", "canonical_source": "https://huggingface.co/blog/torch-mlp-fusion", "published_at": "2026-06-11 00:00:00+00:00", "updated_at": "2026-06-11 21:43:26.900960+00:00", "lang": "en", "topics": ["machine-learning", "neural-networks", "ai-research", "ai-infrastructure", "ai-tools"], "entities": ["PyTorch", "NVIDIA A100", "Hugging Face", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp", "markdown": "https://wpnews.pro/news/profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp.md", "text": "https://wpnews.pro/news/profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp.txt", "jsonld": "https://wpnews.pro/news/profiling-in-pytorch-part-2-from-nn-linear-to-a-fused-mlp.jsonld"}}