torch.compile (inductor)
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 41 lines, MIT.
87_conv_pointwise_2D.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-87-conv-pointwise-2d-torch-compile-inductor?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
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:c60bdea32e35f6812170da89a281c6ec3a4f653e8db6e3b2b93ae10baea06632
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
87_conv_pointwise_2D.py41 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Performs a pointwise 2D convolution operation.
Args:
in_channels (int): Number of channels in the input tensor.
out_channels (int): Number of channels produced by the convolution.
bias (bool, optional): If `True`, adds a learnable bias to the output. Defaults to `False`.
"""
def __init__(self, in_channels: int, out_channels: int, bias: bool = False):
super(Model, self).__init__()
self.conv1d = nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=bias)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Performs the pointwise 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, width).
"""
return self.conv1d(x)
# Test code
batch_size = 16
in_channels = 64
out_channels = 128
width = 1024
height = 1024
def get_inputs():
x = torch.rand(batch_size, in_channels, height, width)
return [x]
def get_init_inputs():
return [in_channels, out_channels]scrolls · 41 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