torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 40 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 40 lines, MIT.
34_InstanceNorm.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-34-instancenorm-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:38a7fe51f4c75bf462ee02871d5875f66c928f8b91cd91480f4e11250c1b737a
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
34_InstanceNorm.py40 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs Instance Normalization.
"""
def __init__(self, num_features: int):
"""
Initializes the InstanceNorm layer.
Args:
num_features (int): Number of features in the input tensor.
"""
super(Model, self).__init__()
self.inorm = nn.InstanceNorm2d(num_features=num_features)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Applies Instance Normalization to the input tensor.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, num_features, height, width).
Returns:
torch.Tensor: Output tensor with Instance Normalization applied, same shape as input.
"""
return self.inorm(x)
batch_size = 112 # heavier workload
features = 64
dim1 = 512
dim2 = 512
def get_inputs():
x = torch.rand(batch_size, features, dim1, dim2)
return [x]
def get_init_inputs():
return [features]scrolls · 40 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