normalize#
- torchaug.transforms.functional.normalize(tensor, mean, std, cast_dtype=None, inplace=False, value_check=False)[source]#
Normalize a tensor image with mean and standard deviation.
Note
If tensor is not float, user has to set cast_dtype to a float
torch.dtype, otherwise it will raise an error. The function will cast and scale the tensor and return a normalized float tensor.See
Normalizefor more details.- Parameters:
tensor (
Tensor) – Tensor image of size (C, H, W) or (B, C, H, W) to be normalized.mean (
list[float] |Tensor) – Sequence of means for each channel.std (
list[float] |Tensor) – Sequence of standard deviations for each channel.cast_dtype (
Optional[dtype], optional) – If not None, scale and cast input to dtype. Expected to be a float dtype.Default:Noneinplace (
bool, optional) – Bool to make this operation inplace.Default:Falsevalue_check (
bool, optional) – Bool to perform tensor value check. Might cause slow down on some devices because of synchronization.Default:False- Return type:
Tensor- Returns:
Normalized float Tensor image.