PyTorch eager
PyTorch · python · MIT
Kernel source · 30 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 30 lines, MIT.
12_Gemm_Multiply_LeakyReLU.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-12-gemm-multiply-leakyrelu-torch?include=source"interfacepython · torch_eager
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:dabde809f49ebf87db1a4df87a322ebfc2f6ef32ce7f01dacd85988d27ac56d8
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
12_Gemm_Multiply_LeakyReLU.py30 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a Gemm, multiplies the result, and applies LeakyReLU.
"""
def __init__(self, in_features, out_features, multiplier, negative_slope):
super(Model, self).__init__()
self.gemm = nn.Linear(in_features, out_features)
self.multiplier = multiplier
self.leaky_relu = nn.LeakyReLU(negative_slope)
def forward(self, x):
x = self.gemm(x)
x = x * self.multiplier
x = self.leaky_relu(x)
return x
batch_size = 1024
in_features = 8192
out_features = 8192
multiplier = 2.0
negative_slope = 0.1
def get_inputs():
return [torch.rand(batch_size, in_features)]
def get_init_inputs():
return [in_features, out_features, multiplier, negative_slope]scrolls · 30 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