Shortcuts

normalize

torchvision.transforms.functional.normalize(tensor: torch.Tensor, mean: List[float], std: List[float], inplace: bool = False)torch.Tensor[source]

Normalize a float tensor image with mean and standard deviation. This transform does not support PIL Image.

Note

This transform acts out of place by default, i.e., it does not mutates the input tensor.

See Normalize for more details.

Parameters
  • tensor (Tensor) – Float tensor image of size (C, H, W) or (B, C, H, W) to be normalized.

  • mean (sequence) – Sequence of means for each channel.

  • std (sequence) – Sequence of standard deviations for each channel.

  • inplace (bool,optional) – Bool to make this operation inplace.

Returns

Normalized Tensor image.

Return type

Tensor

Examples using normalize:

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources