Skip to content
KernelIndex
Search⌘K

submission 66250

Nikhil Bhoir · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

No package. Vendor the mirrored source: 26 lines, June 9 Researcher Reciprocity License v1.0.

submission.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-grayscale-v2-66250?include=source"
interfacepython
Compatibility
measured onNVIDIA B200
declared hardwareNVIDIA B200
architecturessm_100
dtypesfp32

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
RGB to grayscalesuite of 6 cases
NVIDIA B200
6.71ms
#79 of 84
2025-10-24

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:c4acf5a8ba835f678392f9a740b29081d1d668166e6d0533ea9b2195283b5024
license declaredunknown
license concludedunknown
authorsNikhil Bhoir
imported2026-08-15

Kernel source

submission.py26 lines
import torch

def custom_kernel(data):
    """
    Highly optimized grayscale conversion of RGB to Y using PyTorch.
    Args:
        data: tuple of (x, y)
            x: input RGB tensor, shape (H, W, 3), values in [0,1]
            y: output grayscale tensor, shape (H, W), values in [0,1]

    Returns:
        y with grayscale values written in-place.
    """
    x, y = data
    
    # Standard luminance coefficients, placed on correct device & dtype
    weights = torch.tensor([0.2989, 0.5870, 0.1140], device=x.device, dtype=x.dtype)

    # Optimized dot product along the last dimension with no intermediate tensor creation
    y.copy_(torch.tensordot(x, weights, dims=([-1], [0])))
    
    return y



Source code from GPU Mode and the KernelBot dataset · June 9 Researcher Reciprocity License v1.0

Best evidence level for this revision: reported

JSON