Skip to content

Commit cf65f39

Browse files
kohr-hfmassa
authored andcommitted
Add note on in-place nature of Normalize, closes #517 (#520)
1 parent b1ef1fe commit cf65f39

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

torchvision/transforms/functional.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ def to_pil_image(pic, mode=None):
151151
def normalize(tensor, mean, std):
152152
"""Normalize a tensor image with mean and standard deviation.
153153
154+
.. note::
155+
This transform acts in-place, i.e., it mutates the input tensor.
156+
154157
See :class:`~torchvision.transforms.Normalize` for more details.
155158
156159
Args:

torchvision/transforms/transforms.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class Normalize(object):
123123
will normalize each channel of the input ``torch.*Tensor`` i.e.
124124
``input[channel] = (input[channel] - mean[channel]) / std[channel]``
125125
126+
.. note::
127+
This transform acts in-place, i.e., it mutates the input tensor.
128+
126129
Args:
127130
mean (sequence): Sequence of means for each channel.
128131
std (sequence): Sequence of standard deviations for each channel.

0 commit comments

Comments
 (0)