PyTorch eager
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 33 lines, MIT.
42_ConvTranspose2d_GlobalAvgPool_BiasAdd_LogSumExp_Sum_Multiply.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-42-convtranspose2d-globalavgpool-biasadd-logsumexp-sum-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 GlobalAvgPool BiasAdd LogSumExp Sum Multiplyfp32 · [16, 64, 512, 512]
NVIDIA H100
7.17ms±0.00
#2 of 2
2026-03-05
ConvTranspose2d GlobalAvgPool BiasAdd LogSumExp Sum Multiplyfp32 · [16, 64, 512, 512]
NVIDIA H100
10.7ms±0.02
#2 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:bf8af017f8e29efc09c97a51e738bb4ddcba3f271ea5ee536a3910879f8f088e
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
42_ConvTranspose2d_GlobalAvgPool_BiasAdd_LogSumExp_Sum_Multiply.py33 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a transposed convolution, global average pooling, adds a bias, applies log-sum-exp, sum, and multiplication.
"""
def __init__(self, in_channels, out_channels, kernel_size, bias_shape):
super(Model, self).__init__()
self.conv_transpose = nn.ConvTranspose2d(in_channels, out_channels, kernel_size)
self.bias = nn.Parameter(torch.randn(bias_shape))
def forward(self, x):
x = self.conv_transpose(x)
x = torch.mean(x, dim=(2, 3), keepdim=True) # Global average pooling
x = x + self.bias
x = torch.logsumexp(x, dim=1, keepdim=True) # Log-sum-exp
x = torch.sum(x, dim=(2, 3)) # Sum
x = x * 10.0 # Multiplication
return x
batch_size = 16
in_channels = 64
out_channels = 128
height = width = 512
kernel_size = 3
bias_shape = (out_channels, 1, 1)
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, bias_shape]scrolls · 33 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