PyTorch eager
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 33 lines, MIT.
87_Conv2d_Subtract_Subtract_Mish.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-87-conv2d-subtract-subtract-mish-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:ba7b3174e7b3744051e0ce159eebaa63509c3c5bf0d03c8a262223ef2fe2aef3
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
87_Conv2d_Subtract_Subtract_Mish.py33 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Model that performs a convolution, subtracts two values, applies Mish activation.
"""
def __init__(self, in_channels, out_channels, kernel_size, subtract_value_1, subtract_value_2):
super(Model, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size)
self.subtract_value_1 = subtract_value_1
self.subtract_value_2 = subtract_value_2
def forward(self, x):
x = self.conv(x)
x = x - self.subtract_value_1
x = x - self.subtract_value_2
x = torch.nn.functional.mish(x)
return x
batch_size = 128
in_channels = 8
out_channels = 64
height, width = 256, 256
kernel_size = 3
subtract_value_1 = 0.5
subtract_value_2 = 0.2
def get_inputs():
return [torch.rand(batch_size, in_channels, height, width)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, subtract_value_1, subtract_value_2]scrolls · 33 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