PyTorch eager
PyTorch · python · MIT
Kernel source · 31 lines ↓holds 1 record
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 31 lines, MIT.
17_Conv2d_InstanceNorm_Divide.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-17-conv2d-instancenorm-divide-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
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:544a13978d16b14aedd391c49f3a0f0ad1dfb4c01896cffef1d78d2ff10d68e2
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
17_Conv2d_InstanceNorm_Divide.py31 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a convolution, applies Instance Normalization, and divides by a constant.
"""
def __init__(self, in_channels, out_channels, kernel_size, divide_by):
super(Model, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
self.instance_norm = nn.InstanceNorm2d(out_channels)
self.divide_by = divide_by
def forward(self, x):
x = self.conv(x)
x = self.instance_norm(x)
x = x / self.divide_by
return x
batch_size = 128
in_channels = 64
out_channels = 128
height = width = 128
kernel_size = 3
divide_by = 2.0
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, divide_by]scrolls · 31 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