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

fix: fix docs issue #6486

Merged
merged 1 commit into from
Jan 19, 2024
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 docs/api/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ tensor 数学操作
" :ref:`paddle.log <cn_api_paddle_log>` ", "Log 激活函数(计算自然对数)"
" :ref:`paddle.log10 <cn_api_paddle_log10>` ", "Log10 激活函数(计算底为 10 的对数)"
" :ref:`paddle.log2 <cn_api_paddle_log2>` ", "计算 Log1p(加一的自然对数)结果"
" :ref:`paddle.logcumsumexp <cn_api_paddle_logsumexp>` ", "计算 x 的指数的前缀和的对数"
" :ref:`paddle.logcumsumexp <cn_api_paddle_logcumsumexp>` ", "计算 x 的指数的前缀和的对数"
" :ref:`paddle.logical_and <cn_api_paddle_logical_and>` ", "逐元素的对 x 和 y 进行逻辑与运算"
" :ref:`paddle.logical_not <cn_api_paddle_logical_not>` ", "逐元素的对 X Tensor 进行逻辑非运算"
" :ref:`paddle.logical_or <cn_api_paddle_logical_or>` ", "逐元素的对 X 和 Y 进行逻辑或运算"
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/io/DataLoader_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DataLoader 当前支持 ``map-style`` 和 ``iterable-style`` 的数据集,``ma
- **dataset** (Dataset) - DataLoader 从此参数给定数据集中加载数据,此参数必须是 ``paddle.io.Dataset`` 或 ``paddle.io.IterableDataset`` 的一个子类实例。
- **feed_list** (list(Tensor)|tuple(Tensor),可选) - feed 变量列表,由 ``paddle.static.data()`` 创建。当 ``return_list`` 为 False 时,此参数必须设置。默认值为 None。
- **places** (list(Place)|tuple(Place),可选) - 数据需要放置到的 Place 列表。在静态图和动态图模式中,此参数均必须设置。在动态图模式中,此参数列表长度必须是 1。默认值为 None。
- **return_list** (bool,可选) - 每个设备上的数据是否以 list 形式返回。若 return_list = False,每个设备上的返回数据均是 str -> Tensor 的映射表,其中映射表的 key 是每个输入变量的名称。若 return_list = True,则每个设备上的返回数据均是 list(Tensor)。在动态图模式下,此参数必须为 True。默认值为 False
- **return_list** (bool,可选) - 每个设备上的数据是否以 list 形式返回。若 return_list = False,每个设备上的返回数据均是 str -> Tensor 的映射表,其中映射表的 key 是每个输入变量的名称。若 return_list = True,则每个设备上的返回数据均是 list(Tensor)。在动态图模式下,此参数必须为 True。默认值为 True
- **batch_sampler** (BatchSampler,可选) - ``paddle.io.BatchSampler`` 或其子类的实例,DataLoader 通过 ``batch_sampler`` 产生的 mini-batch 索引列表来 ``dataset`` 中索引样本并组成 mini-batch。默认值为 None。
- **batch_size** (int|None,可选) - 每 mini-batch 中样本个数,为 ``batch_sampler`` 的替代参数,若 ``batch_sampler`` 未设置,会根据 ``batch_size`` ``shuffle`` ``drop_last`` 创建一个 ``paddle.io.BatchSampler``。默认值为 1。
- **shuffle** (bool,可选) - 生成 mini-batch 索引列表时是否对索引打乱顺序,为 ``batch_sampler`` 的替代参数,若 ``batch_sampler`` 未设置,会根据 ``batch_size`` ``shuffle`` ``drop_last`` 创建一个 ``paddle.io.BatchSampler``。默认值为 False。
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/stack_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ stack

- **x** (list[Tensor]|tuple[Tensor]) – 输入 x 是多个 Tensor,且这些 Tensor 的维度和数据类型必须相同。支持的数据类型:float32、float64、int32、int64。

- **axis** (int,可选) – 指定对输入 Tensor 进行堆叠运算的轴,有效 axis 的范围是:[−(R+1),R+1],R 是输入中第一个 Tensor 的维数。如果 axis < 0,则 axis=axis+R+1。默认值为 0。
- **axis** (int,可选) – 指定对输入 Tensor 进行堆叠运算的轴,有效 axis 的范围是:[−(R+1),R+1),R 是输入中第一个 Tensor 的维数。如果 axis < 0,则 axis=axis+R+1。默认值为 0。

- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/static/data_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data



会在全局 block 中创建变量(Tensor),该全局变量可被计算图中的算子(operator)访问。该变量可作为占位符用于数据输入。例如用执行器(Executor)输入数据进该变量,当 ``dtype`` 为 None 时,``dtype`` 将通过 ``padle.get_default_dtype()`` 获取全局类型。
会在全局 block 中创建变量(Tensor),该全局变量可被计算图中的算子(operator)访问。该变量可作为占位符用于数据输入。例如用执行器(Executor)输入数据进该变量,当 ``dtype`` 为 None 时,``dtype`` 将通过 ``paddle.get_default_dtype()`` 获取全局类型。


参数
Expand Down
53 changes: 34 additions & 19 deletions docs/api/paddle/transpose_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,40 @@ transpose

.. code-block:: text

x = [[[ 1 2 3 4] [ 5 6 7 8] [ 9 10 11 12]]
[[13 14 15 16] [17 18 19 20] [21 22 23 24]]]
shape(x) = [2,3,4]

# 例 0
perm0 = [1,0,2]
y_perm0 = [[[ 1 2 3 4] [13 14 15 16]]
[[ 5 6 7 8] [17 18 19 20]]
[[ 9 10 11 12] [21 22 23 24]]]
shape(y_perm0) = [3,2,4]

# 例 1
perm1 = [2,1,0]
y_perm1 = [[[ 1 13] [ 5 17] [ 9 21]]
[[ 2 14] [ 6 18] [10 22]]
[[ 3 15] [ 7 19] [11 23]]
[[ 4 16] [ 8 20] [12 24]]]
shape(y_perm1) = [4,3,2]

# 这个代码块中如下的代码都是伪代码,旨在展示函数的执行逻辑与结果

x = to_tensor([[[ 1 2 3 4] [ 5 6 7 8] [ 9 10 11 12]]
[[13 14 15 16] [17 18 19 20] [21 22 23 24]]])
shape(x): return [2,3,4]

# 例一
perm0 = [1,0,2]
y_perm0 = transpose(x, perm0) # 将 x 按 perm0 重排

# y_perm0 的第 0 维 是 x 的第 1 维
# y_perm0 的第 1 维 是 x 的第 0 维
# y_perm0 的第 2 维 是 x 的第 2 维
# 上面两行也可以理解为交换了 x 的第 0 维和第 1 维

y_perm0.data = [[[ 1 2 3 4] [13 14 15 16]]
[[ 5 6 7 8] [17 18 19 20]]
[[ 9 10 11 12] [21 22 23 24]]]
shape(y_perm0): return [3,2,4]

# 例二
perm1 = [2,1,0]
y_perm1 = transpose(x, perm1) # Permute x by perm1

# y_perm1 的第 0 维 是 x 的第 2 维
# y_perm1 的第 1 维 是 x 的第 1 维
# y_perm1 的第 2 维 是 x 的第 0 维
# 上面两行也可以理解为交换了 x 的第 0 维和第 2 维

y_perm1.data = [[[ 1 13] [ 5 17] [ 9 21]]
[[ 2 14] [ 6 18] [10 22]]
[[ 3 15] [ 7 19] [11 23]]
[[ 4 16] [ 8 20] [12 24]]]
shape(y_perm1): return [4,3,2]

代码示例
::::::::::::
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/vision/ops/yolo_box_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ yolo_box
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
- **scale_x_y** (float,可选) - 放缩解码边界框的中心点,默认值:1.0。
- **iou_aware** (bool,可选) - 使用 IoU 置信度,默认值:False。
- **iou_aware_factor** (bool,可选) - IoU 置信度因子,默认值:0.5。
- **iou_aware_factor** (float,可选) - IoU 置信度因子,默认值:0.5。

返回
:::::::::
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/06_distributed_training/model_parallel_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
mp_rank = hcg.get_model_parallel_rank() # 模型并行组 rank


当结合使用模型并行和数据并行时,我们需要指定 ``dp_dgree`` 参数,设置数据并行的并行度。
当结合使用模型并行和数据并行时,我们需要指定 ``dp_degree`` 参数,设置数据并行的并行度。


如上文所述,对于 Transformer 模型,存在两种类型的 Dropout:全局 Dropout 和局部 Dropout;对于全局 Dropout,需要在模型并行的所有卡上设置相同的种子,对于局部 Dropout,则需要设置不同的种子。我们通过如下代码分别设置全局和局部种子:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/jit/debugging_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if __name__ == '__main__':

- **动转静报错栈起始标志位**:`In transformed code`,表示动转静报错信息栈,指运行转换后的代码时的报错信息。实际场景中,可以直接搜索`In transformed code`关键字,从这一行以下开始看报错日志即可。

- **用户代码报错栈**:隐藏了框架层面的无用的报错信息,突用户代码报错栈。我们在出错代码下添加了波浪线和 HERE 指示词来提示具体的出错位置,并扩展了出错行代码上下文,帮助你快速定位出错位置。如上图 3 中所示,可以看出最后出错的用户代码为`x = paddle.reshape(x, shape=[1, two])`。
- **用户代码报错栈**:隐藏了框架层面的无用的报错信息,突出用户代码报错栈。我们在出错代码下添加了波浪线和 HERE 指示词来提示具体的出错位置,并扩展了出错行代码上下文,帮助你快速定位出错位置。如上图 3 中所示,可以看出最后出错的用户代码为`x = paddle.reshape(x, shape=[1, two])`。

- **框架层面报错信息**:提供了静态图组网报错信息。一般可以直接根据最后三行的信息,定位具体是在生成哪个 OpDesc 时报的错误,一般是与执行此 Op 的 infershape 逻辑报的错误。
如上报错信息表明是 reshape Op 出错,出错原因是 tensor x 的 shape 为[3],将其 reshape 为[1, 2]是不被允许的。
Expand Down
2 changes: 1 addition & 1 deletion docs/practices/quick_start/high_level_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@
"collapsed": false
},
"source": [
"这里面有一个注意的点,有些读者可能会疑惑为什么要传递`(1, 28, 28)`这个input_size参数,因为在动态图中,网络定义阶段是还没有得到输入数据的形状信息,想要做网络结构的呈现就无从下手,那么通过告知接口网络结构的输入数据形状,这样网络可以通过逐层的计算推导得到完整的网络结构信息进行呈现。如果是动态图运行模式,那么就不需要给summary接口传递输入数据形状这个值了,因为在Model封装的时候已经定义好了InputSpec,其中包含了输入数据的形状格式。"
"这里面有一个注意的点,有些读者可能会疑惑为什么要传递`(1, 28, 28)`这个input_size参数,因为在动态图中,网络定义阶段是还没有得到输入数据的形状信息,想要做网络结构的呈现就无从下手,那么通过告知接口网络结构的输入数据形状,这样网络可以通过逐层的计算推导得到完整的网络结构信息进行呈现。如果是静态图运行模式,那么就不需要给summary接口传递输入数据形状这个值了,因为在Model封装的时候已经定义好了InputSpec,其中包含了输入数据的形状格式。"
]
},
{
Expand Down