Skip to content
KernelIndex
Search⌘K

PyTorch eager

PyTorch · python · MIT

Use it

Vendorable · source mirrored · MITView source →

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

93_ConvTranspose2d_Add_Min_GELU_Multiply.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-93-convtranspose2d-add-min-gelu-multiply-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
ConvTranspose2d Add Min GELU Multiplyfp32 · [128, 64, 64, 64]
NVIDIA H100
5.73ms±0.03
#2 of 2
2026-03-05
ConvTranspose2d Add Min GELU Multiplyfp32 · [128, 64, 64, 64]
NVIDIA H100
8.78ms±0.00
#2 of 2
2026-03-05

Reported · How evidence levels are derived →

Source and license

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

Kernel source

93_ConvTranspose2d_Add_Min_GELU_Multiply.py35 lines
import torch
import torch.nn as nn

class Model(nn.Module):
    """
    Model that performs a transposed convolution, adds a value, takes the minimum, applies GELU, and multiplies by a value.
    """
    def __init__(self, in_channels, out_channels, kernel_size, stride, add_value, multiply_value):
        super(Model, self).__init__()
        self.conv_transpose = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride=stride)
        self.add_value = add_value
        self.multiply_value = multiply_value

    def forward(self, x):
        x = self.conv_transpose(x)
        x = x + self.add_value
        x = torch.min(x, torch.tensor(0.0, device=x.device))
        x = torch.nn.functional.gelu(x)
        x = x * self.multiply_value
        return x

batch_size = 128
in_channels = 64
out_channels = 128
height, width = 64, 64
kernel_size = 4
stride = 2
add_value = 0.5
multiply_value = 2.0

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

def get_init_inputs():
    return [in_channels, out_channels, kernel_size, stride, add_value, multiply_value]
scrolls · 35 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