torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 27 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 27 lines, MIT.
95_CrossEntropyLoss.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-95-crossentropyloss-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:0e010b71acb63dc19d875418f9264ee3bdeeb8ffd87b1cf2dd603c33d613d008
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
95_CrossEntropyLoss.py27 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
A model that computes Cross Entropy Loss for multi-class classification tasks.
Parameters:
None
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, predictions, targets):
return torch.nn.functional.cross_entropy(predictions, targets)
batch_size = 32768
num_classes = 4096
input_shape = (num_classes,)
dim = 1
def get_inputs():
return [torch.rand(batch_size, *input_shape), torch.randint(0, num_classes, (batch_size,))]
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