UpsampleNearestNeighbor

Nearest-neighbor upscaling utilities.

Notes:

  • Only integer scale factors are supported (scale >= 1)

  • Implemented for Float FP32 tensors which is a common case for MNIST-like data

  • Supported layouts: HW (grayscale), CHW (C,H,W)

Functions

Link copied to clipboard
fun <T : DType, V> upscaleNearest(input: Tensor<T, V>, scale: Int, layout: Layout, ctx: ExecutionContext): Tensor<T, V>

Generic nearest-neighbor upscale supporting common image tensor layouts. Supported layouts: HW, CHW, HWC, NHWC, NCHW.