PyTorch eager
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 48 lines, MIT.
17_SqueezeNetFireModule.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l3-17-squeezenetfiremodule-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:30e165d65ed864963d08064d6ca2456c76cf7b0b319909f3e6c29902ca6b3f6d
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
17_SqueezeNetFireModule.py48 lines
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, in_channels, squeeze_channels, expand1x1_channels, expand3x3_channels):
"""
:param in_channels: Number of input channels
:param squeeze_channels: Number of output channels for the squeeze layer
:param expand1x1_channels: Number of output channels for the 1x1 expand layer
:param expand3x3_channels: Number of output channels for the 3x3 expand layer
"""
super(Model, self).__init__()
self.squeeze = nn.Conv2d(in_channels, squeeze_channels, kernel_size=1)
self.squeeze_activation = nn.ReLU(inplace=True)
self.expand1x1 = nn.Conv2d(squeeze_channels, expand1x1_channels, kernel_size=1)
self.expand1x1_activation = nn.ReLU(inplace=True)
self.expand3x3 = nn.Conv2d(squeeze_channels, expand3x3_channels, kernel_size=3, padding=1)
self.expand3x3_activation = nn.ReLU(inplace=True)
def forward(self, x):
"""
:param x: Input tensor, shape (batch_size, in_channels, height, width)
:return: Output tensor, shape (batch_size, expand1x1_channels + expand3x3_channels, height, width)
"""
x = self.squeeze_activation(self.squeeze(x))
return torch.cat([
self.expand1x1_activation(self.expand1x1(x)),
self.expand3x3_activation(self.expand3x3(x))
], 1)
# Test code
batch_size = 128
num_input_features = 3
num_output_features = 64
height, width = 256, 256
squeeze_channels = 6
expand1x1_channels = 64
expand3x3_channels = 64
def get_inputs():
return [torch.rand(batch_size, num_input_features, height, width)]
def get_init_inputs():
return [num_input_features, squeeze_channels, expand1x1_channels, expand3x3_channels]scrolls · 48 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