torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 28 lines ↓holds 1 record
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 28 lines, MIT.
59_Matmul_Swish_Scaling.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-59-matmul-swish-scaling-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:5d027d92451edc4e086df605b61e277546b551b4caf682927e1cb92fed0b65ae
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
59_Matmul_Swish_Scaling.py28 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a matrix multiplication, applies Swish activation, and scales the result.
"""
def __init__(self, in_features, out_features, scaling_factor):
super(Model, self).__init__()
self.matmul = nn.Linear(in_features, out_features)
self.scaling_factor = scaling_factor
def forward(self, x):
x = self.matmul(x)
x = x * torch.sigmoid(x) # Swish activation
x = x * self.scaling_factor
return x
batch_size = 128
in_features = 32768
out_features = 32768
scaling_factor = 2.0
def get_inputs():
return [torch.rand(batch_size, in_features)]
def get_init_inputs():
return [in_features, out_features, scaling_factor]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