torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 36 lines ↓holds 1 record
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 36 lines, MIT.
80_Gemm_Max_Subtract_GELU.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-80-gemm-max-subtract-gelu-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
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:0fb0e04f6c23ba911975c064882c6424ed5ae26adc6ccd71b26915df106feafb
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
80_Gemm_Max_Subtract_GELU.py36 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a GEMM, followed by a max operation, subtraction, and GELU activation.
"""
def __init__(self, in_features, out_features, max_dim):
super(Model, self).__init__()
self.gemm = nn.Linear(in_features, out_features)
self.max_dim = max_dim
def forward(self, x):
"""
Args:
x: Input tensor of shape (batch_size, in_features)
Returns:
Output tensor of shape (batch_size, out_features)
"""
x = self.gemm(x)
x = torch.max(x, dim=self.max_dim, keepdim=True).values
x = x - x.mean(dim=1, keepdim=True)
x = torch.nn.functional.gelu(x)
return x
batch_size = 1024
in_features = 8192
out_features = 8192
max_dim = 1
def get_inputs():
return [torch.rand(batch_size, in_features)]
def get_init_inputs():
return [in_features, out_features, max_dim]scrolls · 36 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