Skip to content

Commit e0d6eb1

Browse files
authored
Fix Normalizaiton Normalization (#60921)
1 parent 8e99611 commit e0d6eb1

File tree

12 files changed

+48
-48
lines changed

12 files changed

+48
-48
lines changed

python/paddle/audio/functional/functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def create_dct(
313313
Args:
314314
n_mfcc (int): Number of mel frequency cepstral coefficients.
315315
n_mels (int): Number of mel filterbanks.
316-
norm (Optional[str], optional): Normalizaiton type. Defaults to 'ortho'.
316+
norm (Optional[str], optional): Normalization type. Defaults to 'ortho'.
317317
dtype (str, optional): The data type of the return matrix. Defaults to 'float32'.
318318
319319
Returns:

python/paddle/utils/cpp_extension/cpp_extension.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def unix_custom_single_compiler(
480480
# shared library have same ABI suffix with libpaddle.so.
481481
# See https://stackoverflow.com/questions/34571583/understanding-gcc-5s-glibcxx-use-cxx11-abi-or-the-new-abi
482482
add_compile_flag(cflags, ['-D_GLIBCXX_USE_CXX11_ABI=1'])
483-
# Append this macor only when jointly compiling .cc with .cu
483+
# Append this macro only when jointly compiling .cc with .cu
484484
if not is_cuda_file(src) and self.contain_cuda_file:
485485
if core.is_compiled_with_rocm():
486486
cflags.append('-DPADDLE_WITH_HIP')
@@ -829,7 +829,7 @@ def load(
829829
If the above conditions are not met, the corresponding warning will be printed, and a fatal error may
830830
occur because of ABI compatibility.
831831
832-
Compared with ``setup`` interface, it doesn't need extra ``setup.py`` and excute
832+
Compared with ``setup`` interface, it doesn't need extra ``setup.py`` and execute
833833
``python setup.py install`` command. The interface contains all compiling and installing
834834
process underground.
835835
@@ -850,7 +850,7 @@ def load(
850850
from paddle.utils.cpp_extension import load
851851
852852
custom_op_module = load(
853-
name="op_shared_libary_name", # name of shared library
853+
name="op_shared_library_name", # name of shared library
854854
sources=['relu_op.cc', 'relu_op.cu'], # source files of customized op
855855
extra_cxx_cflags=['-g', '-w'], # optional, specify extra flags to compile .cc/.cpp file
856856
extra_cuda_cflags=['-O2'], # optional, specify extra flags to compile .cu file

python/paddle/utils/cpp_extension/extension_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def normalize_extension_kwargs(kwargs, use_cuda=False):
585585
# See _reset_so_rpath for details.
586586
extra_link_args.append(f'-Wl,-rpath,{_get_base_path()}')
587587
# On MacOS, ld don't support `-l:xx`, so we create a
588-
# liblibpaddle.dylib symbol link.
588+
# libpaddle.dylib symbol link.
589589
lib_core_name = create_sym_link_if_not_exist()
590590
extra_link_args.append(f'-l{lib_core_name}')
591591
# ----------------------- -- END -- ----------------------- #

python/paddle/utils/inplace_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __impl__(*args, **kwargs):
3939
for arg in args:
4040
if hasattr(arg, "is_view_var") and arg.is_view_var:
4141
raise ValueError(
42-
f'Sorry about what\'s happend. In to_static mode, {func.__name__}\'s output variable {arg.name} is a viewed Tensor in dygraph. This will result in inconsistent calculation behavior between dynamic and static graphs. You must find the location of the strided API be called, and call {arg.name} = {arg.name}.assign().'
42+
f'Sorry about what\'s happened. In to_static mode, {func.__name__}\'s output variable {arg.name} is a viewed Tensor in dygraph. This will result in inconsistent calculation behavior between dynamic and static graphs. You must find the location of the strided API be called, and call {arg.name} = {arg.name}.assign().'
4343
)
4444

4545
origin_func = f"{func.__module__}.{origin_api_name}"

python/paddle/vision/datasets/folder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class DatasetFolder(Dataset):
130130
... dirname = list(subpath.keys())[0]
131131
... make_directory(root / dirname, subpath[dirname])
132132
133-
>>> directory_hirerarchy = [
133+
>>> directory_hierarchy = [
134134
... {"class_0": [
135135
... "abc.jpg",
136136
... "def.png"]},
@@ -146,7 +146,7 @@ class DatasetFolder(Dataset):
146146
>>> # You can replace this with any directory to explore the structure
147147
>>> # of generated data. e.g. fake_data_dir = "./temp_dir"
148148
>>> fake_data_dir = tempfile.mkdtemp()
149-
>>> make_directory(fake_data_dir, directory_hirerarchy)
149+
>>> make_directory(fake_data_dir, directory_hierarchy)
150150
>>> data_folder_1 = DatasetFolder(fake_data_dir)
151151
>>> print(data_folder_1.classes)
152152
['class_0', 'class_1']

python/paddle/vision/models/shufflenetv2.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def _shufflenet_v2(arch, pretrained=False, **kwargs):
330330

331331
def shufflenet_v2_x0_25(pretrained=False, **kwargs):
332332
"""ShuffleNetV2 with 0.25x output channels, as described in
333-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
333+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
334334
335335
Args:
336336
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -365,7 +365,7 @@ def shufflenet_v2_x0_25(pretrained=False, **kwargs):
365365

366366
def shufflenet_v2_x0_33(pretrained=False, **kwargs):
367367
"""ShuffleNetV2 with 0.33x output channels, as described in
368-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
368+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
369369
370370
Args:
371371
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -400,7 +400,7 @@ def shufflenet_v2_x0_33(pretrained=False, **kwargs):
400400

401401
def shufflenet_v2_x0_5(pretrained=False, **kwargs):
402402
"""ShuffleNetV2 with 0.5x output channels, as described in
403-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
403+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
404404
405405
Args:
406406
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -435,7 +435,7 @@ def shufflenet_v2_x0_5(pretrained=False, **kwargs):
435435

436436
def shufflenet_v2_x1_0(pretrained=False, **kwargs):
437437
"""ShuffleNetV2 with 1.0x output channels, as described in
438-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
438+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
439439
440440
Args:
441441
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -470,7 +470,7 @@ def shufflenet_v2_x1_0(pretrained=False, **kwargs):
470470

471471
def shufflenet_v2_x1_5(pretrained=False, **kwargs):
472472
"""ShuffleNetV2 with 1.5x output channels, as described in
473-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
473+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
474474
475475
Args:
476476
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -505,7 +505,7 @@ def shufflenet_v2_x1_5(pretrained=False, **kwargs):
505505

506506
def shufflenet_v2_x2_0(pretrained=False, **kwargs):
507507
"""ShuffleNetV2 with 2.0x output channels, as described in
508-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
508+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
509509
510510
Args:
511511
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained
@@ -540,7 +540,7 @@ def shufflenet_v2_x2_0(pretrained=False, **kwargs):
540540

541541
def shufflenet_v2_swish(pretrained=False, **kwargs):
542542
"""ShuffleNetV2 with swish activation function, as described in
543-
`"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
543+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_.
544544
545545
Args:
546546
pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained

python/paddle/vision/ops.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def yolo_loss(
112112
box coordinates (w, h), sigmoid cross entropy loss is used for box
113113
coordinates (x, y), objectness loss and classification loss.
114114
115-
Each groud truth box finds a best matching anchor box in all anchors.
115+
Each ground truth box finds a best matching anchor box in all anchors.
116116
Prediction of this anchor box will incur all three parts of losses, and
117117
prediction of anchor boxes with no GT box matched will only incur objectness
118118
loss.
119119
120120
In order to trade off box coordinate losses between big boxes and small
121-
boxes, box coordinate losses will be mutiplied by scale weight, which is
121+
boxes, box coordinate losses will be multiplied by scale weight, which is
122122
calculated as follows.
123123
124124
$$
@@ -134,10 +134,10 @@ def yolo_loss(
134134
While :attr:`use_label_smooth` is set to be :attr:`True`, the classification
135135
target will be smoothed when calculating classification loss, target of
136136
positive samples will be smoothed to :math:`1.0 - 1.0 / class\_num` and target of
137-
negetive samples will be smoothed to :math:`1.0 / class\_num`.
137+
negative samples will be smoothed to :math:`1.0 / class\_num`.
138138
139139
While :attr:`gt_score` is given, which means the mixup score of ground truth
140-
boxes, all losses incured by a ground truth box will be multiplied by its
140+
boxes, all losses incurred by a ground truth box will be multiplied by its
141141
mixup score.
142142
143143
Args:
@@ -146,7 +146,7 @@ def yolo_loss(
146146
and the second dimension(C) stores box locations, confidence
147147
score and classification one-hot keys of each anchor box.
148148
The data type is float32 or float64.
149-
gt_box (Tensor): groud truth boxes, should be in shape of [N, B, 4],
149+
gt_box (Tensor): ground truth boxes, should be in shape of [N, B, 4],
150150
in the third dimension, x, y, w, h should be stored.
151151
x,y is the center coordinate of boxes, w, h are the
152152
width and height, x, y, w, h should be divided by
@@ -163,7 +163,7 @@ def yolo_loss(
163163
ignore_thresh (float): The ignore threshold to ignore confidence loss.
164164
downsample_ratio (int): The downsample ratio from network input to YOLOv3
165165
loss input, so 32, 16, 8 should be set for the
166-
first, second, and thrid YOLOv3 loss operators.
166+
first, second, and third YOLOv3 loss operators.
167167
gt_score (Tensor, optional): mixup score of ground truth boxes, should be in shape
168168
of [N, B]. Default None.
169169
use_label_smooth (bool, optional): Whether to use label smooth. Default True.
@@ -313,7 +313,7 @@ def yolo_box(
313313
The logistic regression value of the 5th channel of each anchor prediction boxes
314314
represents the confidence score of each prediction box, and the logistic
315315
regression value of the last :attr:`class_num` channels of each anchor prediction
316-
boxes represents the classifcation scores. Boxes with confidence scores less than
316+
boxes represents the classification scores. Boxes with confidence scores less than
317317
:attr:`conf_thresh` should be ignored, and box final scores is the product of
318318
confidence scores and classification scores.
319319
@@ -340,7 +340,7 @@ def yolo_box(
340340
be ignored.
341341
downsample_ratio (int): The downsample ratio from network input to
342342
:attr:`yolo_box` operator input, so 32, 16, 8
343-
should be set for the first, second, and thrid
343+
should be set for the first, second, and third
344344
:attr:`yolo_box` layer.
345345
clip_bbox (bool, optional): Whether clip output bonding box in :attr:`img_size`
346346
boundary. Default true.
@@ -1356,7 +1356,7 @@ def decode_jpeg(x, mode='unchanged', name=None):
13561356
need for user to set this property. For more information, please
13571357
refer to :ref:`api_guide_Name`.
13581358
Returns:
1359-
Tensor: A decoded image tensor with shape (imge_channels, image_height, image_width)
1359+
Tensor: A decoded image tensor with shape (image_channels, image_height, image_width)
13601360
13611361
Examples:
13621362
.. code-block:: python
@@ -1809,18 +1809,18 @@ def forward(self, x, boxes, boxes_num, aligned=True):
18091809

18101810
class ConvNormActivation(Sequential):
18111811
"""
1812-
Configurable block used for Convolution-Normalzation-Activation blocks.
1812+
Configurable block used for Convolution-Normalization-Activation blocks.
18131813
This code is based on the torchvision code with modifications.
18141814
You can also see at https://github.com/pytorch/vision/blob/main/torchvision/ops/misc.py#L68
18151815
Args:
18161816
in_channels (int): Number of channels in the input image
1817-
out_channels (int): Number of channels produced by the Convolution-Normalzation-Activation block
1817+
out_channels (int): Number of channels produced by the Convolution-Normalization-Activation block
18181818
kernel_size: (int|list|tuple, optional): Size of the convolving kernel. Default: 3
18191819
stride (int|list|tuple, optional): Stride of the convolution. Default: 1
18201820
padding (int|str|tuple|list, optional): Padding added to all four sides of the input. Default: None,
1821-
in wich case it will calculated as ``padding = (kernel_size - 1) // 2 * dilation``
1821+
in which case it will calculated as ``padding = (kernel_size - 1) // 2 * dilation``
18221822
groups (int, optional): Number of blocked connections from input channels to output channels. Default: 1
1823-
norm_layer (Callable[..., paddle.nn.Layer], optional): Norm layer that will be stacked on top of the convolutiuon layer.
1823+
norm_layer (Callable[..., paddle.nn.Layer], optional): Norm layer that will be stacked on top of the convolution layer.
18241824
If ``None`` this layer wont be used. Default: ``paddle.nn.BatchNorm2D``
18251825
activation_layer (Callable[..., paddle.nn.Layer], optional): Activation function which will be stacked on top of the normalization
18261826
layer (if not ``None``), otherwise on top of the conv layer. If ``None`` this layer wont be used. Default: ``paddle.nn.ReLU``
@@ -1887,7 +1887,7 @@ def nms(
18871887
18881888
If category_idxs and categories are provided, NMS will be performed with a batched style,
18891889
which means NMS will be applied to each category respectively and results of each category
1890-
will be concated and sorted by scores.
1890+
will be concatenated and sorted by scores.
18911891
18921892
If K is provided, only the first k elements will be returned. Otherwise, all box indices sorted by scores will be returned.
18931893

python/paddle/vision/transforms/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def hflip(img):
314314
img (PIL.Image|np.array|Tensor): Image to be flipped.
315315
316316
Returns:
317-
PIL.Image|np.array|paddle.Tensor: Horizontall flipped image.
317+
PIL.Image|np.array|paddle.Tensor: Horizontally flipped image.
318318
319319
Examples:
320320
.. code-block:: python
@@ -966,7 +966,7 @@ def normalize(img, mean, std, data_format='CHW', to_rgb=False):
966966
data_format (str, optional): Data format of input img, should be 'HWC' or
967967
'CHW'. Default: 'CHW'.
968968
to_rgb (bool, optional): Whether to convert to rgb. If input is tensor,
969-
this option will be igored. Default: False.
969+
this option will be ignored. Default: False.
970970
971971
Returns:
972972
PIL.Image|np.array|paddle.Tensor: Normalized mage. Data format is same as input img.

python/paddle/vision/transforms/functional_cv2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def center_crop(img, output_size):
245245
img (np.array): Image to be cropped. (0,0) denotes the top left corner of the image.
246246
output_size (sequence or int): (height, width) of the crop box. If int,
247247
it is used for both directions
248-
backend (str, optional): The image proccess backend type. Options are `pil`, `cv2`. Default: 'pil'.
248+
backend (str, optional): The image process backend type. Options are `pil`, `cv2`. Default: 'pil'.
249249
250250
Returns:
251251
np.array: Cropped image.
@@ -269,7 +269,7 @@ def hflip(img):
269269
img (np.array): Image to be flipped.
270270
271271
Returns:
272-
np.array: Horizontall flipped image.
272+
np.array: Horizontally flipped image.
273273
274274
"""
275275
cv2 = try_import('cv2')
@@ -681,7 +681,7 @@ def to_grayscale(img, num_output_channels=1):
681681

682682

683683
def normalize(img, mean, std, data_format='CHW', to_rgb=False):
684-
"""Normalizes a ndarray imge or image with mean and standard deviation.
684+
"""Normalizes a ndarray image or image with mean and standard deviation.
685685
686686
Args:
687687
img (np.array): input data to be normalized.

python/paddle/vision/transforms/functional_pil.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def center_crop(img, output_size):
268268
img (PIL.Image): Image to be cropped. (0,0) denotes the top left corner of the image.
269269
output_size (sequence or int): (height, width) of the crop box. If int,
270270
it is used for both directions
271-
backend (str, optional): The image proccess backend type. Options are `pil`, `cv2`. Default: 'pil'.
271+
backend (str, optional): The image process backend type. Options are `pil`, `cv2`. Default: 'pil'.
272272
273273
Returns:
274274
PIL.Image: Cropped image.
@@ -292,7 +292,7 @@ def hflip(img):
292292
img (PIL.Image): Image to be flipped.
293293
294294
Returns:
295-
PIL.Image: Horizontall flipped image.
295+
PIL.Image: Horizontally flipped image.
296296
297297
"""
298298

@@ -520,7 +520,7 @@ def to_grayscale(img, num_output_channels=1):
520520
521521
Args:
522522
img (PIL.Image): Image to be converted to grayscale.
523-
backend (str, optional): The image proccess backend type. Options are `pil`,
523+
backend (str, optional): The image process backend type. Options are `pil`,
524524
`cv2`. Default: 'pil'.
525525
526526
Returns:

python/paddle/vision/transforms/functional_tensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def to_grayscale(img, num_output_channels=1, data_format='CHW'):
186186
"""Converts image to grayscale version of image.
187187
188188
Args:
189-
img (paddel.Tensor): Image to be converted to grayscale.
190-
num_output_channels (int, optionl[1, 3]):
189+
img (paddle.Tensor): Image to be converted to grayscale.
190+
num_output_channels (int, optional[1, 3]):
191191
if num_output_channels = 1 : returned image is single channel
192192
if num_output_channels = 3 : returned image is 3 channel
193193
data_format (str, optional): Data format of img, should be 'HWC' or
@@ -585,7 +585,7 @@ def hflip(img, data_format='CHW'):
585585
'CHW'. Default: 'CHW'.
586586
587587
Returns:
588-
paddle.Tensor: Horizontall flipped image.
588+
paddle.Tensor: Horizontally flipped image.
589589
590590
"""
591591
_assert_image_tensor(img, data_format)

0 commit comments

Comments
 (0)