Rgb2GrayScaleMatMul

Color Space Transformation: RGB → Grayscale using direct tensor multiplication (no conv).

Implements the NumPy-equivalent operation per pixel: weights = 0.2989, 0.5870, 0.1140 gray = (H*W x 3) @ weights → reshape(H, W)

Here we avoid any convolution and compute a weighted sum across the channel dimension: (N,3,H,W) * (1,3,1,1) -> sum over channel dim (1) -> (N,1,H,W)

Expected input shape: (N, 3, H, W) Output shape: (N, 1, H, W)

Constructors

Link copied to clipboard
constructor(constCtx: ExecutionContext)

Functions

Link copied to clipboard
open suspend override fun calculate(module: Module<FP16, Float>, inputValue: Tensor<FP16, Float>, executionContext: ExecutionContext, reportProgress: suspend (current: Int, total: Int, message: String?) -> Unit): Tensor<FP16, Float>

Implement this in your models. Call reportProgress whenever you want to emit a progress update.

Link copied to clipboard
open override fun create(executionContext: ExecutionContext): Module<FP16, Float>
Link copied to clipboard
fun model(executionContext: ExecutionContext): Module<FP16, Float>
Link copied to clipboard
open override fun modelCard(): ModelCard