Skip to content
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

对多个文档按照要求修改 #5453

Merged
merged 10 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 6 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 docs/api/paddle/nn/Maxout_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Maxout 激活层,创建一个可调用对象计算。

参数
::::::::::::
- **groups** (int) - 指定将输入张量的 channel 通道维度进行分组的数目。输出的通道数量为通道数除以组数。
- **groups** (int,可选) - 指定将输入张量的 channel 通道维度进行分组的数目。输出的通道数量为通道数除以组数。默认值为 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paddle.nn.Maxout(groups, axis=1, name=None)
所以group其实应该是必选参数,没有默认值

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实这个翻译还是有点问题的,groups

英文的需要在paddle的源代码里改?也就是还需要下载 paddlepaddle的源?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英文的需要在paddle的源代码里改?也就是还需要下载 paddlepaddle的源?

对的,英文文档在 https://github.com/PaddlePaddle/paddle#5453 (comment) 说了怎么找相应的源代码

- **axis** (int,可选) - 指定通道所在维度的索引。当数据格式为 NCHW 时,axis 应该被设置为 1,当数据格式为 NHWC 时,axis 应该被设置为-1 或者 3。默认值为 1。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/nn/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ Embedding 相关函数
" :ref:`paddle.nn.functional.pixel_shuffle <cn_api_nn_functional_pixel_shuffle>` ", "将 Tensor 重新排列"
" :ref:`paddle.nn.functional.pixel_unshuffle <cn_api_nn_functional_pixel_unshuffle>` ", "将 Tensor 重新排列,是 pixel_shuffle 的逆操作"
" :ref:`paddle.nn.functional.square_error_cost <cn_api_fluid_layers_square_error_cost>` ", "用于计算预测值和目标值的方差估计"
" :ref:`paddle.nn.functional.unfold <cn_api_fluid_layers_unfold>` ", "对每一个卷积核覆盖下的区域,将元素重新排成一列"
" :ref:`paddle.nn.functional.unfold <cn_api_nn_functional_unfold>` ", "对每一个卷积核覆盖下的区域,将元素重新排成一列"
" :ref:`paddle.nn.functional.fold <cn_api_nn_functional_fold>` ", "该 Op 用于将一个滑动局部块组合成一个大的张量,通常也被称为 col2im。"
" :ref:`paddle.nn.functional.gather_tree <cn_api_fluid_layers_gather_tree>` ", "整个束搜索结束后使用,获得每个时间步选择的的候选词 id 及其对应的在搜索树中的 parent 节点"
" :ref:`paddle.nn.functional.glu <cn_api_nn_cn_glu>` ", "门控线性单元"
Expand Down
12 changes: 6 additions & 6 deletions docs/api/paddle/nn/Unfold_cn.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.. _cn_api_fluid_layers_unfold:

unfold
Unfold
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job!英文文档删除一下 this op 吧~

-------------------------------

.. py:function:: paddle.nn.Unfold(kernel_size=[3,3], strides=1, paddings=1, dilation=1, name=None)
.. py:class:: paddle.nn.Unfold(kernel_sizes, dilations=1, paddings=0, strides=1, name=None)




实现的功能与卷积中用到的 im2col 函数一样,通常也被称作为 im2col 过程。对于每一个卷积核覆盖下的区域,元素会被重新排成一列。当卷积核在整个图片上滑动时,将会形成一系列的列向量。对于每一个输入形状为[N, C, H, W]的 ``x``,都将会按照下面公式计算出一个形状为[N, Cout, Lout]的输出。

.. note::
对应的 `functional 方法` 请参考::ref:`cn_api_nn_functional_unfold`
对应的 `functional 方法` 请参考::ref:`cn_api_nn_functional_unfold`。


**样例**:
Expand All @@ -31,10 +31,10 @@ unfold
参数
::::::::::::

- **kernel_size** (int|list of int) – 卷积核的尺寸,整数或者整型列表。如果为整型列表,应包含两个元素 ``[k_h, k_w]``,卷积核大小为 ``k_h * k_w``;如果为整数 k,会被当作整型列表 ``[k, k]`` 处理
- **strides** (int|list of int,可选) – 卷积步长,整数或者整型列表。如果为整型列表,应该包含两个元素 ``[stride_h, stride_w]``。如果为整数,则 ``stride_h = stride_w = strides``。默认值为 1
- **paddings** (int|list of int,可选) – 每个维度的扩展,整数或者整型列表。如果为整型列表,长度应该为 4 或者 2;长度为 4 对应的 padding 参数是:[padding_top, padding_left,padding_bottom, padding_right],长度为 2 对应的 padding 参数是[padding_h, padding_w],会被当作[padding_h, padding_w, padding_h, padding_w]处理。如果为整数 padding,则会被当作[padding, padding, padding, padding]处理。默认值为 0
- **kernel_sizes** (int|list of int) – 卷积核的尺寸,整数或者整型列表。如果为整型列表,应包含两个元素 ``[k_h, k_w]``,卷积核大小为 ``k_h * k_w``;如果为整数 k,会被当作整型列表 ``[k, k]`` 处理
- **dilations** (int|list of int,可选) – 卷积膨胀,整型列表或者整数。如果为整型列表,应该包含两个元素[dilation_h, dilation_w]。如果是整数 dilation,会被当作整型列表[dilation, dilation]处理。默认值为 1
- **paddings** (int|list of int,可选) – 每个维度的扩展,整数或者整型列表。如果为整型列表,长度应该为 4 或者 2;长度为 4 对应的 padding 参数是:[padding_top, padding_left,padding_bottom, padding_right],长度为 2 对应的 padding 参数是[padding_h, padding_w],会被当作[padding_h, padding_w, padding_h, padding_w]处理。如果为整数 padding,则会被当作[padding, padding, padding, padding]处理。默认值为 0
- **strides** (int|list of int,可选) – 卷积步长,整数或者整型列表。如果为整型列表,应该包含两个元素 ``[stride_h, stride_w]``。如果为整数,则 ``stride_h = stride_w = strides``。默认值为 1
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

形状
Expand Down
14 changes: 7 additions & 7 deletions docs/api/paddle/nn/Upsample_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Upsample
.. py:class:: paddle.nn.Upsample(size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format='NCHW', name=None)


该 OP 用于调整一个 batch 中图片的大小。
用于调整一个 batch 中图片的大小。

输入为 3-D Tensor 时形状为(num_batches, channels, in_w),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。

Expand Down Expand Up @@ -150,17 +150,17 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
参数
:::::::::

- **size** (list|tuple|Variable|None) - 输出 Tensor,输入为 3D 张量时,形状为为(out_w)的 1-D Tensor。输入为 4D 张量时,形状为为(out_h, out_w)的 2-D Tensor。输入为 5-D Tensor 时,形状为(out_d, out_h, out_w)的 3-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者形状为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为 1。默认值为 None。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的高度或宽度的乘数因子。out_shapescale 至少要设置一个。out_shape 的优先级高于 scale。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **size** (list|tuple|Tensor|None) - 输出 Tensor 的形状,输入为 3D 张量时,形状为为(out_w)的 1-D Tensor。输入为 4D 张量时,形状为为(out_h, out_w)的 2-D Tensor。输入为 5-D Tensor 时,形状为(out_d, out_h, out_w)的 3-D Tensor。如果 :code:`size` 是列表,每一个元素可以是整数或者形状为[1]的变量。如果 :code:`size` 是变量,则其维度大小为 1。默认值为 None。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的深度、高度或宽度的缩放因子。:code:`size`:code:`scale_factor` 至少要设置一个。:code:`size` 的优先级高于:code:`scale_factor`。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **scale_factor** (float|Tensor|list|tuple|None)-输入的深度、高度或宽度的缩放因子。:code:`size` 和 :code:`scale_factor` 至少要设置一个。:code:`size` 的优先级高于:code:`scale_factor`。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的深度、高度或宽度的缩放因子。:code:`size` 和 :code:`scale_factor` 至少要设置一个。:code:`size` 的优先级高于 :code:`scale_factor`。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外 size=None, scale_factor=None ,所以这俩是可选参数啦

- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_corners** bool,可选- 一个可选的 bool 型参数,如果为 True,则将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 True
- **align_mode** int,可选- 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *dst_indx + 0.5-0.5;如果为'1',代表 src_idx = scale * dst_index。
- **data_format** str,可选- 指定输入的数据格式,输出的数据格式将与输入保持一致。对于 3-D Tensor,支持 NCHW(num_batches, channels, width),对于 4-D Tensor,支持 NCHW(num_batches, channels, height, width) 或者 NHWC(num_batches, height, width, channels),对于 5-D Tensor,支持 NCDHW(num_batches, channels, depth, height, width)或者 NDHWC(num_batches, depth, height, width, channels),默认值:'NCHW'。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 False。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值为 0
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。对于 3-D Tensor,支持 NCW(num_batches, channels, width)或者 NWC(num_batches, width, channels),对于 4-D Tensor,支持 NCHW(num_batches, channels, height, width) 或者 NHWC(num_batches, height, width, channels),对于 5-D Tensor,支持 NCDHW(num_batches, channels, depth, height, width)或者 NDHWC(num_batches, depth, height, width, channels),默认值:'NCHW'。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
3-D Tensor,形状为 (num_batches, channels, out_w) ;4-D Tensor,形状为 (num_batches, channels, out_h, out_w) 或 (num_batches, out_h, out_w, channels);或者 5-D Tensor,形状为 (num_batches, channels, out_d, out_h, out_w) 或 (num_batches, out_d, out_h, out_w, channels)。
3-D Tensor,形状为(num_batches, channels, out_w)或者(num_batches, out_w, channels);4-D Tensor,形状为 (num_batches, channels, out_h, out_w) 或 (num_batches, out_h, out_w, channels);或者 5-D Tensor,形状为 (num_batches, channels, out_d, out_h, out_w) 或 (num_batches, out_d, out_h, out_w, channels)。


代码示例
Expand Down
4 changes: 2 additions & 2 deletions docs/api/paddle/nn/functional/mse_loss_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ mse_loss
:::::::::
- **input** (Tensor) - 预测值,维度为 :math:`[N_1, N_2, ..., N_k]` 的多维 Tensor。数据类型为 float32 或 float64。
- **label** (Tensor) - 目标值,维度为 :math:`[N_1, N_2, ..., N_k]` 的多维 Tensor。数据类型为 float32 或 float64。
- **reduction** (string, optional) - 输出的归约方法可以是'none'、'mean'或'sum'。
- **reduction** (string, 可选) - 输出的归约方法可以是'none'、'mean'或'sum'。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **reduction** (string, 可选) - 输出的归约方法可以是'none'、'mean'或'sum'。
- **reduction** (str, 可选) - 输出的归约方法可以是'none'、'mean'或'sum'。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

顺便英文文档也改一下吧~


- 如果 :attr:`reduction` 是 ``'mean'``,则返回减少的平均损失。
- 如果 :attr:`reduction` 是 ``'sum'``,则返回减少的总损失。
- 如果 :attr: `reduction` 为 `'none'`,返回未减少的损失。默认为 `'mean'`。

- **name** (str, optional) - 操作的名称(可选,默认为 None)。 更多信息请参考:ref:`api_guide_Name`。
- **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None

返回
:::::::::
Expand Down
4 changes: 2 additions & 2 deletions docs/api/paddle/nn/functional/unfold_cn.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _cn_api_fluid_layers_unfold:
.. _cn_api_nn_functional_unfold:

unfold
-------------------------------
Expand Down Expand Up @@ -47,7 +47,7 @@ unfold
- **strides** (int|list of int,可选) – 卷积步长,整数或者整型列表。如果为整型列表,应该包含两个元素 ``[stride_h, stride_w]``。如果为整数,则 ``stride_h = stride_w = strides``。默认值为 1
- **paddings** (int|list of int,可选) – 每个维度的扩展,整数或者整型列表。如果为整型列表,长度应该为 4 或者 2;长度为 4 对应的 padding 参数是:[padding_top, padding_left,padding_bottom, padding_right],长度为 2 对应的 padding 参数是[padding_h, padding_w],会被当作[padding_h, padding_w, padding_h, padding_w]处理。如果为整数 padding,则会被当作[padding, padding, padding, padding]处理。默认值为 0
- **dilations** (int|list of int,可选) – 卷积膨胀,整型列表或者整数。如果为整型列表,应该包含两个元素[dilation_h, dilation_w]。如果是整数 dilation,会被当作整型列表[dilation, dilation]处理。默认值为 1
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
- **name** (str,可选) 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。


返回
Expand Down