torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 29 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 29 lines, MIT.
52_Conv2d_Activation_BatchNorm.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-52-conv2d-activation-batchnorm-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:3f6b889a38870e605de67150499e56b58300ca725fee9a152f595c152eb877b1
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
52_Conv2d_Activation_BatchNorm.py29 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a convolution, applies activation, and then applies Batch Normalization.
"""
def __init__(self, in_channels, out_channels, kernel_size, eps=1e-5, momentum=0.1):
super(Model, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
self.bn = nn.BatchNorm2d(out_channels, eps=eps, momentum=momentum)
def forward(self, x):
x = self.conv(x)
x = torch.multiply(torch.tanh(torch.nn.functional.softplus(x)), x)
x = self.bn(x)
return x
batch_size = 64
in_channels = 64
out_channels = 128
height, width = 128, 128
kernel_size = 3
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size]scrolls · 29 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