torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 42 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 42 lines, MIT.
92_Conv2d_GroupNorm_Tanh_HardSwish_ResidualAdd_LogSumExp.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-92-conv2d-groupnorm-tanh-hardswish-residualadd-logsumexp-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
Conv2d GroupNorm Tanh HardSwish ResidualAdd LogSumExpfp32 · [128, 8, 128, 128]
NVIDIA H100
1.74ms±0.01
#1 of 2
2026-03-05
Conv2d GroupNorm Tanh HardSwish ResidualAdd LogSumExpfp32 · [128, 8, 128, 128]
NVIDIA H100
3.44ms±0.00
#1 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:bdcdc1b905cb14bcce1345ae98bdec077d57eaf809c44daa8dc198a558d40ef4
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
92_Conv2d_GroupNorm_Tanh_HardSwish_ResidualAdd_LogSumExp.py42 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a convolution, applies Group Normalization, Tanh, HardSwish,
Residual Addition, and LogSumExp.
"""
def __init__(self, in_channels, out_channels, kernel_size, groups, eps=1e-5):
super(Model, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
self.group_norm = nn.GroupNorm(groups, out_channels, eps=eps)
self.tanh = nn.Tanh()
self.hard_swish = nn.Hardswish()
def forward(self, x):
# Convolution
x_conv = self.conv(x)
# Group Normalization
x_norm = self.group_norm(x_conv)
# Tanh
x_tanh = self.tanh(x_norm)
# HardSwish
x_hard_swish = self.hard_swish(x_tanh)
# Residual Addition
x_res = x_conv + x_hard_swish
# LogSumExp
x_logsumexp = torch.logsumexp(x_res, dim=1, keepdim=True)
return x_logsumexp
batch_size = 128
in_channels = 8
out_channels = 64
height, width = 128, 128
kernel_size = 3
groups = 16
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, groups]scrolls · 42 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