mlr_pipeops_trafo_normalize: Normalization Transformation

mlr_pipeops_trafo_normalizeR Documentation

Normalization Transformation

Description

Normalizes the channels by subtracting mean and dividing by std. The channels are the third-to-last dimension, e.g. C for images of shape ⁠(N, C, H, W)⁠ or videos of shape ⁠(N, T, C, H, W)⁠, as in torchvision::transform_normalize, which this is the same as for these inputs. For inputs with fewer dimensions, e.g. ⁠(N, C)⁠ or ⁠(N, C, L)⁠, the channels are the second dimension. Inputs that are not floating point, e.g. images stored as integers, are converted to the default floating point type (torch_get_default_dtype()) first. The preprocessing is applied to the whole batch.

Being a trafo_ operator, its stages parameter starts out as "both", so the transformation is applied both while training and when predicting. Set stages = "train" to restrict it to training. See PipeOpTaskPreprocTorch for the stages parameter and this naming convention.

Format

R6Class inheriting from PipeOpTaskPreprocTorch.

Construction

po("trafo_normalize")

Parameters

Id Type Default Levels
mean untyped -
std untyped -
stages character - train, predict, both
affect_columns untyped selector_all()

mlr3torch documentation built on Oct. 30, 2026, 5:10 p.m.