PyTorch eager
PyTorch · python · MIT
Kernel source · 49 lines ↓holds 1 record
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 49 lines, MIT.
80_conv_standard_2D_square_input_asymmetric_kernel___dilated____padded__.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-80-conv-standard-2d-square-input-asymmetric-kernel-dilated-padded-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
conv standard 2D square input asymmetric kernel dilated paddedfp32 · [8, 32, 512, 512]
NVIDIA H100
2.41ms±0.06
#1 of 2
2026-03-05
conv standard 2D square input asymmetric kernel dilated paddedfp32 · [8, 32, 512, 512]
NVIDIA H100
5.51ms±0.03
#2 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:a973ce57ea28fdd4cb8fcd36f4e810f3eecba2fe42ae3643051143313efa1bc3
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
80_conv_standard_2D_square_input_asymmetric_kernel___dilated____padded__.py49 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Performs a standard 2D convolution operation with square input and asymmetric kernel, with dilation and padding.
Args:
in_channels (int): Number of channels in the input tensor.
out_channels (int): Number of channels produced by the convolution.
kernel_size (tuple): Size of the convolution kernel (height, width).
stride (int, optional): Stride of the convolution. Defaults to 1.
padding (tuple, optional): Padding applied to the input (top/bottom, left/right). Defaults to (0, 0).
dilation (tuple, optional): Spacing between kernel elements (height, width). Defaults to (1, 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: tuple, stride: int = 1, padding: tuple = (0, 0), dilation: tuple = (1, 1), bias: bool = False):
super(Model, self).__init__()
self.conv2d = nn.Conv2d(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 convolution.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, in_channels, height, width).
Returns:
torch.Tensor: Output tensor of shape (batch_size, out_channels, height_out, width_out).
"""
return self.conv2d(x)
# Test code
batch_size = 8
in_channels = 32
out_channels = 64
kernel_size = (5, 9)
width = 512
height = 512
stride = 1
padding = (2, 4)
dilation = (2, 3)
def get_inputs():
x = torch.rand(batch_size, in_channels, height, width)
return [x]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, stride, padding, dilation]scrolls · 49 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