PyTorch eager
PyTorch · python · MIT
Kernel source · 59 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 59 lines, MIT.
85_conv_depthwise_2D_asymmetric_input_asymmetric_kernel.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-85-conv-depthwise-2d-asymmetric-input-asymmetric-kernel-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 depthwise 2D asymmetric input asymmetric kernelfp32 · [32, 128, 128, 256]
NVIDIA H100
2.27ms±0.02
#1 of 2
2026-03-05
conv depthwise 2D asymmetric input asymmetric kernelfp32 · [32, 128, 128, 256]
NVIDIA H100
3.03ms±0.00
#1 of 2
2026-03-05
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:e646dcce4c61f1a3796ab71e2eafc0e2e5090df9be9fd9c872c80bdaf0985df0
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
85_conv_depthwise_2D_asymmetric_input_asymmetric_kernel.py59 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Performs a depthwise 2D convolution with asymmetric input and asymmetric kernel.
Args:
in_channels (int): Number of channels in the input tensor.
out_channels (int): Number of channels produced by the convolution.
kernel_size_h (int): Height of the convolution kernel.
kernel_size_w (int): Width of the convolution kernel.
stride_h (int, optional): Stride of the convolution in height dimension. Defaults to 1.
stride_w (int, optional): Stride of the convolution in width dimension. Defaults to 1.
padding_h (int, optional): Padding applied to the input in height dimension. Defaults to 0.
padding_w (int, optional): Padding applied to the input in width dimension. Defaults to 0.
dilation_h (int, optional): Spacing between kernel elements in height dimension. Defaults to 1.
dilation_w (int, optional): Spacing between kernel elements in width dimension. Defaults to 1.
groups (int, optional): Number of blocked connections from input channels to output channels. 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_h: int, kernel_size_w: int, stride_h: int = 1, stride_w: int = 1, padding_h: int = 0, padding_w: int = 0, dilation_h: int = 1, dilation_w: int = 1, groups: int = 1, bias: bool = False):
super(Model, self).__init__()
self.conv2d = nn.Conv2d(in_channels, in_channels, (kernel_size_h, kernel_size_w), stride=(stride_h, stride_w), padding=(padding_h, padding_w), dilation=(dilation_h, dilation_w), groups=in_channels, bias=bias)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Performs the depthwise 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 = 32
in_channels = 128
out_channels = 128
kernel_size_h = 3
kernel_size_w = 7
width = 256
height = 128
stride_h = 1
stride_w = 1
padding_h = 0
padding_w = 0
dilation_h = 1
dilation_w = 1
groups = in_channels
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_h, kernel_size_w, stride_h, stride_w, padding_h, padding_w, dilation_h, dilation_w, groups]scrolls · 59 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