Commit cf65f394 authored by Holger Kohr's avatar Holger Kohr Committed by Francisco Massa
Browse files

Add note on in-place nature of Normalize, closes #517 (#520)

parent b1ef1fe7
...@@ -151,6 +151,9 @@ def to_pil_image(pic, mode=None): ...@@ -151,6 +151,9 @@ def to_pil_image(pic, mode=None):
def normalize(tensor, mean, std): def normalize(tensor, mean, std):
"""Normalize a tensor image with mean and standard deviation. """Normalize a tensor image with mean and standard deviation.
.. note::
This transform acts in-place, i.e., it mutates the input tensor.
See :class:`~torchvision.transforms.Normalize` for more details. See :class:`~torchvision.transforms.Normalize` for more details.
Args: Args:
......
...@@ -123,6 +123,9 @@ class Normalize(object): ...@@ -123,6 +123,9 @@ class Normalize(object):
will normalize each channel of the input ``torch.*Tensor`` i.e. will normalize each channel of the input ``torch.*Tensor`` i.e.
``input[channel] = (input[channel] - mean[channel]) / std[channel]`` ``input[channel] = (input[channel] - mean[channel]) / std[channel]``
.. note::
This transform acts in-place, i.e., it mutates the input tensor.
Args: Args:
mean (sequence): Sequence of means for each channel. mean (sequence): Sequence of means for each channel.
std (sequence): Sequence of standard deviations for each channel. std (sequence): Sequence of standard deviations for each channel.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment