-
Notifications
You must be signed in to change notification settings - Fork 766
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
[Docathon][Add CN Doc No.4-5] #6362
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6108480
add docs
zade23 85f0508
Update docs/api/paddle/incubate/nn/functional/fused_matmul_bias_cn.rst
zade23 c66f188
Merge branch 'PaddlePaddle:develop' into den_doc_45
zade23 afbfd15
Update FusedLinear_cn.rst
zade23 0720218
Update fused_matmul_bias_cn.rst
zade23 125fe2d
Update fused_matmul_bias_cn.rst
zade23 870912d
Merge branch 'PaddlePaddle:develop' into den_doc_45
zade23 b28b23a
Merge branch 'PaddlePaddle:develop' into den_doc_45
zade23 7ffa072
Update FusedLinear_cn.rst
zade23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. _cn_api_paddle_incubate_nn_FusedLinear: | ||
|
||
FusedLinear | ||
------------------------------- | ||
|
||
.. py:class:: paddle.incubate.nn.FusedLinear(in_features, out_features, weight_attr=None, bias_attr=None, transpose_weight=False, name=None) | ||
|
||
Linear 层只接受一个 Tensor 作为输入,形状为 :math:`[batch\_size, *, in\_features]`,其中 :math:`*` 表示可以为任意个额外的维度。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
另外,此方法也需要要求CUDA 11.6及以上,需要写上此约束条件。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Down |
||
该层可以计算输入 Tensor 与权重矩阵 :math:`W` 的乘积,然后生成形状为 :math:`[batch\_size, *, out\_features]` 的输出 Tensor。 | ||
如果 :math:`bias\_attr` 不是 False,则将创建一个偏置参数并将其添加到输出中。 | ||
|
||
参数 | ||
:::::::::::: | ||
- **in_features** (int) – 线性变换层输入单元的数目。 | ||
- **out_features** (int) – 线性变换层输出单元的数目。 | ||
- **weight_attr** (ParamAttr,可选) - 指定权重参数的属性。默认值为 None,权重将初始化为零。具体用法请参见 :ref:`cn_api_paddle_ParamAttr` 。 | ||
- **transpose_weight** (bool) - 在乘积运算前是否转置 `weight` 张量。 | ||
- **bias_attr** (ParamAttr|bool,可选) – 指定偏置参数的属性。:math:`bias\_attr` 为 bool 类型且设置为 False 时,表示不会为该层添加偏置。:math:`bias\_attr` 如果设置为 True 或者 None,则表示使用默认的偏置参数属性,将偏置参数初始化为 0。具体用法请参见 :ref:`cn_api_paddle_ParamAttr`。默认值为 None。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
属性 | ||
::::::::: | ||
|
||
weight | ||
''''''''' | ||
|
||
本层的可学习参数,类型为 ``Parameter`` 。 | ||
|
||
bias | ||
''''''''' | ||
|
||
本层的可学习偏置,类型为 ``Parameter`` 。 | ||
|
||
形状 | ||
::::::::: | ||
|
||
- 输入:形状为 :math:`[batch\_size, *, in\_features]` 的多维 Tensor。 | ||
- 输出:形状为 :math:`[batch\_size, *, out\_features]` 的多维 Tensor。 | ||
|
||
代码示例 | ||
::::::::: | ||
|
||
COPY-FROM: paddle.incubate.nn.FusedLinear |
28 changes: 28 additions & 0 deletions
28
docs/api/paddle/incubate/nn/functional/fused_matmul_bias_cn.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. _cn_api_paddle_incubate_nn_functional_fused_matmul_bias: | ||
|
||
fused_matmul_bias | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.nn.functional.fused_matmul_bias(x, y, bias=None, transpose_x=False, transpose_y=False, name=None) | ||
|
||
应用两个张量的矩阵乘法,然后如果提供了偏置,进行偏置加法。 | ||
|
||
此方法要求 CUDA 版本不低于 11.6。 | ||
|
||
参数 | ||
:::::::::::: | ||
- **x** (Tensor) - 第一个输入 ``Tensor``,被乘 ``Tensor``。 | ||
- **y** (Tensor) - 第二个输入 ``Tensor``,被乘 ``Tensor``。其秩必须为 2。 | ||
- **bias** (Tensor,可选) - 输入的偏置。如果为 None,则不执行偏置加法。否则,偏置将被加到矩阵乘法结果上。默认:None。 | ||
- **transpose_x** (bool,可选) - 是否在乘积运算前转置 :math:`x`。默认:False。 | ||
- **transpose_y** (bool,可选) - 是否在乘积运算前转置 :math:`y`。默认:False。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
输出 ``Tensor` | ||
zade23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.incubate.nn.functional.fused_matmul_bias |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请直接参考
https://github.com/PaddlePaddle/docs/blob/develop/docs/api/paddle/nn/Linear_cn.rst
书写,内容里还有不少可以改进的地方。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改。参考
Linear_cn.rst
的内容和格式。