Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ English | [简体中文](./README_cn.md) | [日本語](./README_ja.md)

Source files for contents presented at [PaddlePaddle documentation](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html).

Note: English version API docs are generaly docstrings in [PaddlePaddle/Paddle](https://github.com/PaddlePaddle/Paddle), documents for [other PaddlePaddle projects](https://www.paddlepaddle.org.cn/overview) are being managed in their respective ways.
Note: English version API docs are generally docstrings in [PaddlePaddle/Paddle](https://github.com/PaddlePaddle/Paddle), documents for [other PaddlePaddle projects](https://www.paddlepaddle.org.cn/overview) are being managed in their respective ways.

## Codebase structure

Expand Down
18 changes: 0 additions & 18 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ Creenshot = "Creenshot"
Embeddding = "Embeddding"
Embeding = "Embeding"
Engish = "Engish"
Generater = "Generater"
Gloabal = "Gloabal"
Imporvement = "Imporvement"
Interfce = "Interfce"
Kernal = "Kernal"
Learing = "Learing"
Moible = "Moible"
Operaton = "Operaton"
Expand Down Expand Up @@ -128,21 +123,8 @@ foward = "foward"
functinal = "functinal"
fundemental = "fundemental"
funtion = "funtion"
gard = "gard"
generaly = "generaly"
gloabl = "gloabl"
heigh = "heigh"
ilter = "ilter"
imge = "imge"
implememted = "implememted"
indeces = "indeces"
indentical = "indentical"
indicies = "indicies"
indx = "indx"
infered = "infered"
inferface = "inferface"
infor = "infor"
ingore = "ingore"
instert = "instert"
instrinsics = "instrinsics"
interchangable = "interchangable"
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/nn/Upsample_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
- **scale_factor** (float|Tensor|list|tuple|None,可选) - 输入的深度、高度或宽度的缩放因子。:code:`size` 和 :code:`scale_factor` 至少要设置一个。:code:`size` 的优先级高于 :code:`scale_factor`。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 False。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值为 0。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_index + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值为 0。
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"。
- **recompute_scale_factor** (bool,可选) - 是否在插值计算中重新计算乘数因子。当设置为 True 时,必须提供 scale_factor 参数,函数会用 scale_factor 和输入张量的形状计算输出张量的形状,然后根据输出张量形状和输入张量形状重新计算乘数因子。该参数可用于 scale_factor 为浮点数的情况。当设置为 False 时,将直接使用 size 或 scale_factor 进行插值计算,不进行重新计算。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/nn/functional/interpolate_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
- **scale_factor** (float|Tensor|list|tuple|None)-输入的高度或宽度的乘数因子。out_shape 和 scale 至少要设置一个。out_shape 的优先级高于 scale。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 False。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值:0。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_index + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值:0。
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"。
- **recompute_scale_factor** (bool,可选) - 是否在插值计算中重新计算乘数因子。当设置为 True 时,必须提供 scale_factor 参数,函数会用 scale_factor 和输入张量的形状计算输出张量的形状,然后根据输出张量形状和输入张量形状重新计算乘数因子。该参数可用于 scale_factor 为浮点数的情况。当设置为 False 时,将直接使用 size 或 scale_factor 进行插值计算,不进行重新计算。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/nn/functional/upsample_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
- **size** (list|tuple|Tensor|None) - 输出 Tensor,输入为 4D Tensor 时,形状为为(out_h, out_w)的 2-D Tensor。输入为 5-D Tensor 时,形状为(out_d, out_h, out_w)的 3-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者形状为[]的变量。如果 :code:`out_shape` 是变量,则其维度大小为 1。默认值为 None。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的高度或宽度的乘数因子。out_shape 和 scale 至少要设置一个。out_shape 的优先级高于 scale。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_mode** (int,可选)- 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。
- **align_mode** (int,可选)- 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_index + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 True
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/put_along_axis_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ put_along_axis
返回
:::::::::

输出 Tensor,indeces 矩阵选定的下标会被插入 value,与 ``arr`` 数据类型相同。
输出 Tensor,indices 矩阵选定的下标会被插入 value,与 ``arr`` 数据类型相同。

代码示例
:::::::::
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/sparse/nn/functional/subm_conv2d_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ subm_conv2d
- stride (int|list|tuple, optional): 步长大小, 意味着卷积的步长。如果步长为 list/tuple, 它必须包含两个整数 (stride_height, stride_width)。否则, stride_height = stride_width = stride。stride 的默认值为 1。
- padding (string|int|list|tuple, optional): 填充大小。它表示零填充在每个维度的两侧的数量。
如果 'padding' 是字符串,则 'VALID' 或 'SAME' 是填充算法。
如果填充大小是元组或列表,它可以有三种形式:'[pad_heigh, pad_width]' 或 '[pad_height_top, pad_height_bottom, pad_width_left, pad_width_right]'。
如果填充大小是元组或列表,它可以有三种形式:'[pad_height, pad_width]' 或 '[pad_height_top, pad_height_bottom, pad_width_left, pad_width_right]'。
当 'data_format' 为 'NHWC' 时, 'padding' 可以采用以下形式 '[[0,0], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]'。padding 的默认值为 0。
- dilation (int|list|tuple, optional): 空洞大小。它表示内核点之间的间距。
如果 dilation 是列表/元组,则它必须包含两个整数 (dilation_height、dilation_width)。
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/take_along_axis_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ take_along_axis
返回
:::::::::

输出 Tensor,包含 indeces 矩阵选定的元素,与 ``arr`` 数据类型相同。
输出 Tensor,包含 indices 矩阵选定的元素,与 ``arr`` 数据类型相同。

代码示例
:::::::::
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/vision/ops/decode_jpeg_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ decode_jpeg
返回
:::::::::

具有形状(imge_channels、image_height、image_width)的解码图像 Tensor。
具有形状(image_channels、image_height、image_width)的解码图像 Tensor。

代码示例
:::::::::
Expand Down
2 changes: 1 addition & 1 deletion docs/design/concepts/tensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Before writing code, please make sure you already look through Majel Source Code


### Memory Management
`Allocation` manages a block of memory in device(CPU/GPU). We use `Place` to decribe memory location. The details of memory allocation and deallocation are implememted in `Allocator` and `DeAllocator`. Related low-level API such as `hl_malloc_device()` and `hl_malloc_host()` are provided by Paddle.
`Allocation` manages a block of memory in device(CPU/GPU). We use `Place` to decribe memory location. The details of memory allocation and deallocation are implemented in `Allocator` and `DeAllocator`. Related low-level API such as `hl_malloc_device()` and `hl_malloc_host()` are provided by Paddle.

### Dim and Array
#### Dim
Expand Down
6 changes: 3 additions & 3 deletions docs/design/concurrent/parallel_do.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ block1 { # the forward pass
}
block2 { # the backward pass
parent_block: 1
vars: data_grad, h1_grad, h2_grad, loss_gard, local_w1_grad, local_w2_grad
vars: data_grad, h1_grad, h2_grad, loss_grad, local_w1_grad, local_w2_grad
ops: softmax_grad,
fc_grad
fc_grad
}
}
```

## Performance Imporvement
## Performance Improvement

There are serial places we can make this parallel_do faster.

Expand Down Expand Up @@ -148,7 +148,7 @@ block1 {
}
block2 {
parent_block: 1
vars: data_grad, h1_grad, h2_grad, loss_gard, w1_grad, w2_grad
vars: data_grad, h1_grad, h2_grad, loss_grad, w1_grad, w2_grad
ops: softmax_grad,
fc_grad, allreduce(places, scopes, w1_grad),
fc_grad, allreduce(places, scopes, w2_grad)
Expand Down
24 changes: 12 additions & 12 deletions docs/dev_guides/api_contributing_guides/auto_parallel_op_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ class TestElementwiseSPMDRule(unittest.TestCase):
result_dist_attrs = self.binary_rule.infer_forward(
self.x_dist_tensor_spec, self.y_dist_tensor_spec
)
infered_input_dist_attrs = result_dist_attrs[0] # 推导得到的 input dims mapping
infered_output_dist_attrs = result_dist_attrs[1] # 推导得到的 output dims mapping
inferred_input_dist_attrs = result_dist_attrs[0] # 推导得到的 input dims mapping
inferred_output_dist_attrs = result_dist_attrs[1] # 推导得到的 output dims mapping

# 检查结果是否正确
self.assertEqual(infered_input_dist_attrs[0].dims_mapping, [0, -1])
self.assertEqual(infered_input_dist_attrs[1].dims_mapping, [0, -1])
self.assertEqual(infered_output_dist_attrs[0].dims_mapping, [0, -1])
self.assertEqual(inferred_input_dist_attrs[0].dims_mapping, [0, -1])
self.assertEqual(inferred_input_dist_attrs[1].dims_mapping, [0, -1])
self.assertEqual(inferred_output_dist_attrs[0].dims_mapping, [0, -1])

# 逆向推导单测
def test_backward_multi_mesh_dim(self):
Expand All @@ -351,16 +351,16 @@ class TestElementwiseSPMDRule(unittest.TestCase):
self.y_dist_tensor_spec,
self.out_dist_tensor_spec,
)
infered_input_dist_attrs = resulted_dist_attrs[0]
infered_output_dist_attrs = resulted_dist_attrs[1]
inferred_input_dist_attrs = resulted_dist_attrs[0]
inferred_output_dist_attrs = resulted_dist_attrs[1]

self.assertEqual(len(resulted_dist_attrs), 2)
self.assertEqual(len(infered_input_dist_attrs), 2)
self.assertEqual(len(infered_output_dist_attrs), 1)
self.assertEqual(len(inferred_input_dist_attrs), 2)
self.assertEqual(len(inferred_output_dist_attrs), 1)

self.assertEqual(infered_input_dist_attrs[0].dims_mapping, [0, 1, -1])
self.assertEqual(infered_input_dist_attrs[1].dims_mapping, [0, 1, -1])
self.assertEqual(infered_output_dist_attrs[0].dims_mapping, [0, 1, -1])
self.assertEqual(inferred_input_dist_attrs[0].dims_mapping, [0, 1, -1])
self.assertEqual(inferred_input_dist_attrs[1].dims_mapping, [0, 1, -1])
self.assertEqual(inferred_output_dist_attrs[0].dims_mapping, [0, 1, -1])
```

## 三、自定义算子
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guides/api_contributing_guides/new_cpp_op_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ class TestTraceOp(OpTest):
- 第二个参数`'Out'` : 指定前向网络最终的输出目标变量`Out`。
- 第三个参数`check_pir` : `check_pir=True` 表示开启 PIR 模式单测(默认为 `False`,需手动开启),`check_dygraph` 默认为 `True`, 表示默认开启动态图单测。
- 对于存在多个输入的反向算子测试,需要指定只计算部分输入梯度的 case
- 例如,[test_elementwise_sub_op.py](https://github.com/PaddlePaddle/Paddle/tree/develop/test/legacy_test/test_elementwise_sub_op.py) 中的 `test_check_grad_ignore_x` 和 `test_check_grad_ingore_y`分支用来测试只需要计算一个输入梯度的情况
- 例如,[test_elementwise_sub_op.py](https://github.com/PaddlePaddle/Paddle/tree/develop/test/legacy_test/test_elementwise_sub_op.py) 中的 `test_check_grad_ignore_x` 和 `test_check_grad_ignore_y`分支用来测试只需要计算一个输入梯度的情况
- 此处第三个参数 `max_relative_error` :指定检测梯度时能容忍的最大相对误差值。

```python
Expand Down
22 changes: 11 additions & 11 deletions docs/eval/【Hackathon No.111】PR.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class MyNet(paddle.nn.Layer):
kernel_size=(3,3),
stride=2)

self.gloabl_pool = paddle.nn.AdaptiveAvgPool2D((1,1))
self.global_pool = paddle.nn.AdaptiveAvgPool2D((1,1))

self.fc1 = paddle.nn.Linear(in_features=128, out_features=8)

Expand All @@ -250,7 +250,7 @@ class MyNet(paddle.nn.Layer):
x = F.relu(x)
x = self.conv3(x)
x = F.relu(x)
x = self.gloabl_pool(x)
x = self.global_pool(x)
x = paddle.squeeze(x, axis=[2, 3])
x = self.fc1(x)
x = x / paddle.norm(x, axis=1, keepdim=True)
Expand Down Expand Up @@ -356,8 +356,8 @@ x_test_t = paddle.to_tensor(x_test)
test_images_embeddings = model(x_test_t)
similarities_matrix = paddle.matmul(test_images_embeddings, test_images_embeddings, transpose_y=True)

indicies = paddle.argsort(similarities_matrix, descending=True)
indicies = indicies.numpy()
indices = paddle.argsort(similarities_matrix, descending=True)
indices = indices.numpy()

examples = np.empty(
(
Expand All @@ -375,7 +375,7 @@ for row_idx in range(num_classes):
anchor_idx = random.choice(examples_for_class)

examples[row_idx, 0] = x_test[anchor_idx]
anchor_near_neighbours = indicies[anchor_idx][1:near_neighbours_per_example+1]
anchor_near_neighbours = indices[anchor_idx][1:near_neighbours_per_example+1]
for col_idx, nn_idx in enumerate(anchor_near_neighbours):
examples[row_idx, col_idx + 1] = x_test[nn_idx]

Expand Down Expand Up @@ -459,7 +459,7 @@ class MyNet2(paddle.nn.Layer):
kernel_size=(3,3),
stride=2)

self.gloabl_pool = paddle.nn.AdaptiveAvgPool2D((1,1))
self.global_pool = paddle.nn.AdaptiveAvgPool2D((1,1))

self.fc1 = paddle.nn.Linear(in_features=128, out_features=8)

Expand All @@ -472,7 +472,7 @@ class MyNet2(paddle.nn.Layer):
x = F.relu(x)
x = self.conv3(x)
x = F.relu(x)
x = self.gloabl_pool(x)
x = self.global_pool(x)
x = paddle.squeeze(x, axis=[2, 3])
x = self.fc1(x)
x = x / paddle.norm(x, axis=1, keepdim=True)
Expand Down Expand Up @@ -799,8 +799,8 @@ x_test_t = paddle.to_tensor(x_test)
test_images_embeddings = model_2(x_test_t)
similarities_matrix = paddle.matmul(test_images_embeddings, test_images_embeddings, transpose_y=True)

indicies = paddle.argsort(similarities_matrix, descending=True)
indicies = indicies.numpy()
indices = paddle.argsort(similarities_matrix, descending=True)
indices = indices.numpy()

examples = np.empty(
(
Expand All @@ -818,7 +818,7 @@ for row_idx in range(num_classes):
anchor_idx = random.choice(examples_for_class)

examples[row_idx, 0] = x_test[anchor_idx]
anchor_near_neighbours = indicies[anchor_idx][1:near_neighbours_per_example+1]
anchor_near_neighbours = indices[anchor_idx][1:near_neighbours_per_example+1]
for col_idx, nn_idx in enumerate(anchor_near_neighbours):
examples[row_idx, col_idx + 1] = x_test[nn_idx]

Expand All @@ -836,7 +836,7 @@ show_collage(examples)
报错信息可读性差比较好,比如:
Traceback (most recent call last):
File "D:\Postgraduate\deep_learning\jiaoliu\pp\train.py", line 191, in <module>
indicies = paddle.argsort(similarities_matrix, descending=True)
indices = paddle.argsort(similarities_matrix, descending=True)
File "F:\Users\ASUS\anaconda3\envs\paddlepaddle-gpu\lib\site-packages\paddle\tensor\search.py", line 92, in argsort
_, ids = _C_ops.argsort(x, 'axis', axis, 'descending', descending)
SystemError: (Fatal) Operator argsort raises an struct paddle::memory::allocation::BadAlloc exception.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/advanced/gradient_clip_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
.. code:: ipython3
linear = paddle.nn.Linear(10, 10)
clip = paddle.nn.ClipGradByGloabalNorm(clip_norm=1.0)
clip = paddle.nn.ClipGradByGlobalNorm(clip_norm=1.0)
sdg = paddle.optimizer.SGD(learning_rate=0.1, parameters=linear.parameters(), grad_clip=clip)
如果仅需裁剪部分参数,用法如下:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/advanced/gradient_clip_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ By default, Gradients of all parameters in SGD optimizer will be clipped:
.. code:: ipython3

linear = paddle.nn.Linear(10, 10)
clip = paddle.nn.ClipGradByGloabalNorm(clip_norm=1.0)
clip = paddle.nn.ClipGradByGlobalNorm(clip_norm=1.0)
sdg = paddle.optimizer.SGD(learning_rate=0.1, parameters=linear.parameters(), grad_clip=clip)

You can also clip gradients of a part of parameters as follow:
Expand Down
Loading