PyTorch eager
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 37 lines, MIT.
24_Conv3d_Min_Softmax.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l2-24-conv3d-min-softmax-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:9c3cb6a883c87ce1def0a35c96711fdaec047fe960ab2484f246f30e9413370f
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
24_Conv3d_Min_Softmax.py37 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a 3D convolution, applies minimum operation along a specific dimension,
and then applies softmax.
"""
def __init__(self, in_channels, out_channels, kernel_size, dim):
super(Model, self).__init__()
self.conv = nn.Conv3d(in_channels, out_channels, kernel_size)
self.dim = dim
def forward(self, x):
"""
Args:
x (torch.Tensor): Input tensor of shape (batch_size, in_channels, D, H, W)
Returns:
torch.Tensor: Output tensor of shape (batch_size, out_channels, H, W)
"""
x = self.conv(x)
x = torch.min(x, dim=self.dim)[0] # Apply minimum along the specified dimension
x = torch.softmax(x, dim=1) # Apply softmax along the channel dimension
return x
batch_size = 128
in_channels = 3
out_channels = 24 # Increased output channels
D, H, W = 24, 32, 32 # Increased depth
kernel_size = 3
dim = 2 # Dimension along which to apply minimum operation (e.g., depth)
def get_inputs():
return [torch.rand(batch_size, in_channels, D, H, W)]
def get_init_inputs():
return [in_channels, out_channels, kernel_size, dim]scrolls · 37 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