toTensor

fun RgbImage.toTensor(order: ChannelOrder, mean: Float = 0.0f, scale: Float = 1.0f): Tensor

Packs the image into a [1, 3, height, width] float tensor: (value - mean) * scale per channel value.

Common recipes: raw 0..255 (mean = 0, scale = 1), or [-1, 1] (mean = 127.5, scale = 1/127.5).