torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 34 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 34 lines, MIT.
35_Conv2d_Subtract_HardSwish_MaxPool_Mish.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-35-conv2d-subtract-hardswish-maxpool-mish-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 Subtract HardSwish MaxPool Mishfp32 · [128, 64, 128, 128]
NVIDIA H100
4.32ms±0.01
#1 of 2
2026-03-05
Conv2d Subtract HardSwish MaxPool Mishfp32 · [128, 64, 128, 128]
NVIDIA H100
4.35ms±0.00
#1 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:ad1341e659cb8bc8f9579ebb8934da0a55aca018a3e725b42b1ffe63d4f482b2
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
35_Conv2d_Subtract_HardSwish_MaxPool_Mish.py34 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a convolution, subtracts a value, applies HardSwish, MaxPool, and Mish activation functions.
"""
def __init__(self, in_channels, out_channels, kernel_size, subtract_value, pool_kernel_size):
super(Model, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
self.subtract_value = subtract_value
self.pool = nn.MaxPool2d(pool_kernel_size)
def forward(self, x):
x = self.conv(x)
x = x - self.subtract_value
x = torch.nn.functional.hardswish(x)
x = self.pool(x)
x = torch.nn.functional.mish(x)
return x
batch_size = 128
in_channels = 64
out_channels = 128
height = width = 128
kernel_size = 3
subtract_value = 0.5
pool_kernel_size = 2
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, subtract_value, pool_kernel_size]scrolls · 34 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