Skip to content
KernelIndex
Search⌘K

torch.compile (inductor)

PyTorch · python · MIT

Use it

Vendorable · source mirrored · MITView source →

No package. Vendor the mirrored source: 31 lines, MIT.

65_Conv2d_AvgPool_Sigmoid_Sum.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-65-conv2d-avgpool-sigmoid-sum-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 AvgPool Sigmoid Sumfp32 · [128, 8, 384, 384]
NVIDIA H100
8.78ms±0.01
#1 of 2
2026-03-05
Conv2d AvgPool Sigmoid Sumfp32 · [128, 8, 384, 384]
NVIDIA H100
14.5ms±0.06
#1 of 2
2026-03-05

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:f1130e4ade22f2625c7bcc9ba92a9c4304f2f5ec588006a3a950284ac5b84bc3
license declaredMIT
license concludedMIT
imported2026-08-26

Kernel source

65_Conv2d_AvgPool_Sigmoid_Sum.py31 lines
import torch
import torch.nn as nn

class Model(nn.Module):
    """
    This model performs a convolution, average pooling, applies sigmoid, and sums the result.
    """
    def __init__(self, in_channels, out_channels, kernel_size, pool_kernel_size):
        super(Model, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
        self.avg_pool = nn.AvgPool2d(pool_kernel_size)

    def forward(self, x):
        x = self.conv(x)
        x = self.avg_pool(x)
        x = torch.sigmoid(x)
        x = torch.sum(x, dim=[1,2,3]) # Sum over all spatial dimensions
        return x

batch_size = 128
in_channels = 8
out_channels = 64
height, width = 384, 384
kernel_size = 3
pool_kernel_size = 4

def get_inputs():
    return [torch.rand(batch_size, in_channels, height, width)]

def get_init_inputs():
    return [in_channels, out_channels, kernel_size, pool_kernel_size]
scrolls · 31 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