torch.compile (inductor)
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 50 lines, MIT.
81_conv_transposed_2D_asymmetric_input_square_kernel___dilated____padded____strided__.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-81-conv-transposed-2d-asymmetric-input-square-kernel-dilated-padded-strided-torch-com?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
conv transposed 2D asymmetric input square kernel dilated padded stridedfp32 · [16, 32, 64, 128]
NVIDIA H100
1.88ms±0.00
#2 of 2
2026-03-05
conv transposed 2D asymmetric input square kernel dilated padded stridedfp32 · [16, 32, 64, 128]
NVIDIA H100
2.58ms±0.00
#2 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:249b46f36c21010def063ca4f97d47b56ea330cde495e13951a1bd7a44e669b9
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
81_conv_transposed_2D_asymmetric_input_square_kernel___dilated____padded____strided__.py50 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Performs a 2D transposed convolution operation with asymmetric input and square kernel, supporting dilation, padding, and stride.
Args:
in_channels (int): Number of channels in the input tensor.
out_channels (int): Number of channels produced by the convolution.
kernel_size (int): Size of the convolution kernel (square, e.g., 3 for a 3x3 kernel).
stride (int, optional): Stride of the convolution. Defaults to 1.
padding (int, optional): Padding applied to the input. Defaults to 0.
dilation (int, optional): Spacing between kernel elements. Defaults to 1.
bias (bool, optional): If `True`, adds a learnable bias to the output. Defaults to `False`.
"""
def __init__(self, in_channels: int, out_channels: int, kernel_size: int, stride: int = 1, padding: int = 0, dilation: int = 1, bias: bool = False):
super(Model, self).__init__()
self.conv_transpose2d = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride=stride, padding=padding, dilation=dilation, bias=bias)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Performs the 2D transposed convolution.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, in_channels, height_in, width_in).
Returns:
torch.Tensor: Output tensor of shape (batch_size, out_channels, height_out, width_out).
"""
return self.conv_transpose2d(x)
# Test code
batch_size = 16
in_channels = 32
out_channels = 64
kernel_size = 3
height_in = 64
width_in = 128
stride = 5
padding = 1
dilation = 2
def get_inputs():
x = torch.rand(batch_size, in_channels, height_in, width_in)
return [x]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, stride, padding, dilation]scrolls · 50 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