torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 25 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 25 lines, MIT.
97_ScaledDotProductAttention.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-97-scaleddotproductattention-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:691a1dad1128a6e035ceb1981e4ecc60d1ed8520ac15998f0cb2ddc9a6791959
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
97_ScaledDotProductAttention.py25 lines
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
def forward(self, Q: torch.Tensor, K: torch.Tensor, V: torch.Tensor) -> torch.Tensor:
out = torch.nn.functional.scaled_dot_product_attention(Q, K, V)
return out
batch_size = 32
num_heads = 32
sequence_length = 512
embedding_dimension = 1024
def get_inputs():
Q = torch.rand(batch_size, num_heads, sequence_length, embedding_dimension)
K = torch.rand(batch_size, num_heads, sequence_length, embedding_dimension)
V = torch.rand(batch_size, num_heads, sequence_length, embedding_dimension)
return [Q, K, V]
def get_init_inputs():
return []
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