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.
28_BMM_InstanceNorm_Sum_ResidualAdd_Multiply.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-28-bmm-instancenorm-sum-residualadd-multiply-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:f3e178f4884d84b59a3cb4f8b54b6f9e04196feeb68cf5aeff62166f6c25147c
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
28_BMM_InstanceNorm_Sum_ResidualAdd_Multiply.py36 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a batch matrix multiplication, instance normalization, summation, residual addition, and multiplication.
"""
def __init__(self, in_features, out_features, eps=1e-5, momentum=0.1):
super(Model, self).__init__()
self.bmm = nn.Linear(in_features, out_features)
self.instance_norm = nn.InstanceNorm2d(out_features, eps=eps, momentum=momentum)
def forward(self, x, y):
"""
Args:
x (torch.Tensor): Input tensor of shape (batch_size, in_features).
y (torch.Tensor): Input tensor of shape (batch_size, out_features).
Returns:
torch.Tensor: Output tensor of shape (batch_size, out_features).
"""
x = self.bmm(x)
x = self.instance_norm(x.unsqueeze(1).unsqueeze(1)).squeeze(1).squeeze(1)
x = x + y
x = x * y
return x
batch_size = 1024 # Increased batch size
in_features = 8192 # Increased input features
out_features = 8192 # Increased output features
def get_inputs():
return [torch.rand(batch_size, in_features), torch.rand(batch_size, out_features)]
def get_init_inputs():
return [in_features, out_features]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