torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 36 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 36 lines, MIT.
13_DenseNet121TransitionLayer.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l3-13-densenet121transitionlayer-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:20c5785de3f43b4d28b14be37bdfee51ec518a0d5d907e81a010d93f1a9b8704
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
13_DenseNet121TransitionLayer.py36 lines
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, num_input_features: int, num_output_features: int):
"""
:param num_input_features: The number of input feature maps
:param num_output_features: The number of output feature maps
"""
super(Model, self).__init__()
self.transition = nn.Sequential(
nn.BatchNorm2d(num_input_features),
nn.ReLU(inplace=True),
nn.Conv2d(num_input_features, num_output_features, kernel_size=1, bias=False),
nn.AvgPool2d(kernel_size=2, stride=2)
)
def forward(self, x):
"""
:param x: Input tensor of shape (batch_size, num_input_features, height, width)
:return: Downsampled tensor with reduced number of feature maps
"""
return self.transition(x)
batch_size = 128
num_input_features = 32
num_output_features = 64
height, width = 256, 256
def get_inputs():
return [torch.rand(batch_size, num_input_features, height, width)]
def get_init_inputs():
return [num_input_features, num_output_features]
scrolls · 36 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