PyTorch eager
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 40 lines, MIT.
96_ConvTranspose3d_Multiply_Max_GlobalAvgPool_Clamp.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-96-convtranspose3d-multiply-max-globalavgpool-clamp-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
ConvTranspose3d Multiply Max GlobalAvgPool Clampfp32 · [128, 3, 16, 32, 32]
NVIDIA H100
5.35ms±0.00
#2 of 2
2026-03-05
ConvTranspose3d Multiply Max GlobalAvgPool Clampfp32 · [128, 3, 16, 32, 32]
NVIDIA H100
7.43ms±0.02
#2 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:253da5c28a076cc91aab236025d1c88df65a6238b958f028fc6a6c6f77ac7173
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
96_ConvTranspose3d_Multiply_Max_GlobalAvgPool_Clamp.py40 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a transposed 3D convolution, multiplies by a scalar, applies max pooling,
global average pooling, and clamps the output.
"""
def __init__(self, in_channels, out_channels, kernel_size, stride, padding, scale, maxpool_kernel_size):
super(Model, self).__init__()
self.conv_transpose = nn.ConvTranspose3d(in_channels, out_channels, kernel_size, stride=stride, padding=padding)
self.scale = scale
self.maxpool = nn.MaxPool3d(kernel_size=maxpool_kernel_size)
self.global_avg_pool = nn.AdaptiveAvgPool3d((1, 1, 1))
self.clamp_min = 0
self.clamp_max = 1
def forward(self, x):
x = self.conv_transpose(x)
x = x * self.scale
x = self.maxpool(x)
x = self.global_avg_pool(x)
x = torch.clamp(x, min=self.clamp_min, max=self.clamp_max)
return x
batch_size = 128
in_channels = 3
out_channels = 16
depth, height, width = 16, 32, 32
kernel_size = 3
stride = 2
padding = 1
scale = 0.5
maxpool_kernel_size = 2
def get_inputs():
return [torch.rand(batch_size, in_channels, depth, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, stride, padding, scale, maxpool_kernel_size]scrolls · 40 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