torch.compile (inductor)
PyTorch · python · MIT
Kernel source · 44 lines ↓holds 2 records
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 44 lines, MIT.
90_cumprod.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-90-cumprod-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.
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:39fe0a47f770c7887f62f56df282034e67f4a7eb9fb95d1073fcfcfc9196a27a
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
90_cumprod.py44 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
A model that performs a cumulative product operation along a specified dimension.
Parameters:
dim (int): The dimension along which to perform the cumulative product operation.
"""
def __init__(self, dim):
"""
Initialize the CumulativeProductModel.
Args:
dim (int): The dimension along which to perform the cumulative product.
"""
super(Model, self).__init__()
self.dim = dim
def forward(self, x):
"""
Forward pass, computing the cumulative product along the specified dimension.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, *input_shape).
Returns:
torch.Tensor: Tensor of the same shape as `x` after applying cumulative product along `dim`.
"""
return torch.cumprod(x, dim=self.dim)
# Define input dimensions and parameters
batch_size = 32768
input_shape = (32768,)
dim = 1
def get_inputs():
return [torch.rand(batch_size, *input_shape)]
def get_init_inputs():
return [dim]
scrolls · 44 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