torch.compile (inductor)
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 33 lines, MIT.
4_Matrix_vector_multiplication_.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-4-matrix-vector-multiplication-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:31d390b2ae3ea0c714b77e44a79e4467c9177f110f926bfcca80501ce7c8e91f
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
4_Matrix_vector_multiplication_.py33 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs matrix-vector multiplication (C = A * B).
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
"""
Performs matrix-vector multiplication.
Args:
A: Input matrix of shape (M, K).
B: Input vector of shape (K, 1).
Returns:
Output vector of shape (M, 1).
"""
return torch.matmul(A, B)
M = 256 * 8 # 2048
K = 131072 * 8 # 1048576
def get_inputs():
A = torch.rand(M, K)
B = torch.rand(K, 1)
return [A, B]
def get_init_inputs():
return [] # No special initialization inputs neededscrolls · 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