Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions torchvision/transforms/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def to_pil_image(pic, mode=None):
def normalize(tensor, mean, std):
"""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.

Args:
Expand Down
3 changes: 3 additions & 0 deletions torchvision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ class Normalize(object):
will normalize each channel of the input ``torch.*Tensor`` i.e.
``input[channel] = (input[channel] - mean[channel]) / std[channel]``

.. note::
This transform acts in-place, i.e., it mutates the input tensor.

Args:
mean (sequence): Sequence of means for each channel.
std (sequence): Sequence of standard deviations for each channel.
Expand Down