torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 43 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 43 lines, MIT.
51_Gemm_Subtract_GlobalAvgPool_LogSumExp_GELU_ResidualAdd.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-51-gemm-subtract-globalavgpool-logsumexp-gelu-residualadd-torch-compile-inductor?include=source"interfacepython · torch_compile_inductor
symbolModel.forward
Compatibility
measured onNVIDIA H100
declared hardwaredeclared only
architectures—
dtypes
Benchmark evidence
2 measurements across 1 GPU, fastest first.
Operation / workload
Hardware
Latency
Rank
Observed
Gemm Subtract GlobalAvgPool LogSumExp GELU ResidualAddfp32 · [2048, 8192]
NVIDIA H100
5.49ms±0.01
#1 of 2
2026-03-05
Gemm Subtract GlobalAvgPool LogSumExp GELU ResidualAddfp32 · [2048, 8192]
NVIDIA H100
8.04ms±0.04
#1 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:a06b5ca3daf02eb6dac3ad01ae31e966ca0b4adf1390d69a2451b3c943b4819a
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
51_Gemm_Subtract_GlobalAvgPool_LogSumExp_GELU_ResidualAdd.py43 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a series of operations: Gemm, Subtract, GlobalAvgPool, LogSumExp, GELU, and ResidualAdd.
"""
def __init__(self, in_features, out_features, bias=True):
super(Model, self).__init__()
self.gemm = nn.Linear(in_features, out_features, bias=bias)
self.subtract = nn.Parameter(torch.randn(out_features))
def forward(self, x):
original_x = x.clone().detach()
# Gemm
x = self.gemm(x)
# Subtract
x = x - self.subtract
# GlobalAvgPool
x = torch.mean(x, dim=1, keepdim=True)
# LogSumExp
x = torch.logsumexp(x, dim=1, keepdim=True)
# GELU
x = torch.nn.functional.gelu(x)
# ResidualAdd
x = x + original_x
return x
batch_size = 2048
in_features = 8192
out_features = 8192
def get_inputs():
return [torch.rand(batch_size, in_features)]
def get_init_inputs():
return [in_features, out_features]scrolls · 43 lines total
Source code from KernelBench, © 2023 Anne Ouyang, Simon Guo, Azalia Mirhoseini (Scaling Intelligence Lab, Stanford University), MIT License · MIT
Best evidence level for this revision: reported
JSON