torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 40 lines ↓holds 1 record
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 40 lines, MIT.
52_Argmin_over_a_dimension.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-52-argmin-over-a-dimension-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:16955197c0ffe8ea5afe93bfb6489f966e303fa4d9e2c6cf87b40d7cf38be33b
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
52_Argmin_over_a_dimension.py40 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that finds the index of the minimum value along a specified dimension.
"""
def __init__(self, dim: int):
"""
Initializes the model with the dimension to perform argmin on.
Args:
dim (int): Dimension along which to find the minimum value.
"""
super(Model, self).__init__()
self.dim = dim
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Finds the index of the minimum value along the specified dimension.
Args:
x (torch.Tensor): Input tensor.
Returns:
torch.Tensor: Tensor containing the indices of the minimum values along the specified dimension.
"""
return torch.argmin(x, dim=self.dim)
batch_size = 128
dim1 = 4096
dim2 = 4095
dim = 1
def get_inputs():
x = torch.rand(batch_size, dim1, dim2)
return [x]
def get_init_inputs():
return [dim]scrolls · 40 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