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.

45_Gemm_Sigmoid_LogSumExp.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-45-gemm-sigmoid-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
Gemm Sigmoid LogSumExpfp32 · [16384, 2048]
NVIDIA H100
8.42ms±0.01
#1 of 2
2026-03-05
Gemm Sigmoid LogSumExpfp32 · [16384, 2048]
NVIDIA H100
12.4ms±0.10
#1 of 2
2026-03-05

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:5ff6a5bd1377dafb342b5f3b3aa6a0973aa39cd809c0f4ddcf7df49936d660a0
license declaredMIT
license concludedMIT
imported2026-08-26

Kernel source

45_Gemm_Sigmoid_LogSumExp.py31 lines
import torch
import torch.nn as nn

class Model(nn.Module):
    """
    Model that performs a matrix multiplication (Gemm), applies Sigmoid,
    another Gemm, and computes LogSumExp over features.
    """
    def __init__(self, input_size, hidden_size, output_size):
        super(Model, self).__init__()
        self.linear1 = nn.Linear(input_size, hidden_size)
        self.linear2 = nn.Linear(hidden_size, output_size)

    def forward(self, x):
        x = self.linear1(x)
        x = torch.sigmoid(x)
        x = self.linear2(x)
        x = torch.logsumexp(x, dim=1)  # compute LogSumExp over features per sample
        return x

batch_size = 16384
input_size = 2048
hidden_size = 4096
output_size = 1024

def get_inputs():
    return [torch.rand(batch_size, input_size)]

def get_init_inputs():
    return [input_size, hidden_size, output_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