-
Notifications
You must be signed in to change notification settings - Fork 750
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.30、31] #6447
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c5a1d27
[Docathon][Add CN Doc No.30、31]
Kaedeharai ff41d3b
modified: docs/api/paddle/incubate/nn/functional/fused_rotary_posi…
Kaedeharai d2f068e
Merge branch 'develop' of https://github.com/PaddlePaddle/docs into d301
Kaedeharai 5b0fb5e
Apply suggestions from code review
Kaedeharai ea5192d
Merge branch 'PaddlePaddle:develop' into d301
Kaedeharai 5102777
Update docs/api/paddle/sparse/nn/functional/subm_conv2d_cn.rst
Kaedeharai a3cbe83
Update docs/api/paddle/sparse/nn/functional/subm_conv2d_cn.rst
sunzhongkai588 c122711
Update docs/api/paddle/sparse/nn/functional/subm_conv2d_cn.rst
sunzhongkai588 e906d30
Update docs/api/paddle/sparse/nn/functional/subm_conv2d_cn.rst
sunzhongkai588 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
30 changes: 30 additions & 0 deletions
30
docs/api/paddle/incubate/nn/functional/fused_rotary_position_embedding_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,30 @@ | ||
.. _cn_api_paddle_incubate_nn_functional_fused_rotary_position_embedding: | ||
|
||
fused_rotary_position_embedding | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.nn.functional.fused_rotary_position_embedding(q, k=None, v=None, sin=None, cos=None, position_ids=None, use_neox_rotary_style=True) | ||
融合旋转位置编码。 | ||
|
||
参数 | ||
:::::::::: | ||
|
||
- **q** (Tensor) - 输入张量。 数据类型可以是 bfloat16, float16, float32 或 float64。 q 的形状必须是 [batch_size, seq_len, num_heads, head_dim],并且 head_dim 必须是 2 的倍数。 | ||
- **k** (Tensor, 可选) - 输入张量。 数据类型可以是 bfloat16, float16, float32 或 float64。 k 的形状必须是 [batch_size, seq_len, num_heads, head_dim],并且 head_dim 必须是 2 的倍数。 | ||
- **v** (Tensor, 可选) - 输入张量。 数据类型可以是 bfloat16, float16, float32 或 float64。 v 的形状必须是 [batch_size, seq_len, num_heads, head_dim],并且 head_dim 必须是 2 的倍数。 | ||
- **sin** (Tensor, 可选) - 输入张量。 数据类型可以是 bfloat16, float16, float32 或 float64。 sin 的形状必须是 [seq_len, head_dim] 或 [1, seq_len, 1, head_dim], 并且 head_dim 必须是 2 的倍数。 | ||
- **cos** (Tensor, 可选) - 输入张量。 数据类型可以是 bfloat16, float16, float32 或 float64。 cos 的形状必须是 [seq_len, head_dim] 或 [1, seq_len, 1, head_dim], 并且 head_dim 必须是 2 的倍数。 | ||
- **position_ids** (Tensor, 可选) - 输入张量。 数据类型为 int64. position_ids 的形状为[batch_size, seq_len]。 | ||
- **use_neox_rotary_style** (可选|bool) - 当 use_neox_rotary_style 为 True, 每两个相邻的数字计算一次。 当 use_neox_rotary_style 为 False, 计算与前半段和后半段位置相对应的数字。 默认值为 True。 | ||
|
||
|
||
返回 | ||
:::::::::: | ||
|
||
- out_q/out_k/out_v 表示融合旋转位置嵌入的张量,具有与 `q` 相同的形状和数据类型。 | ||
|
||
|
||
代码示例 | ||
:::::::::: | ||
|
||
COPY-FROM: paddle.incubate.nn.functional.fused_rotary_position_embedding |
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
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,59 @@ | ||
.. _cn_api_paddle_sparse_nn_functional_subm_conv2d: | ||
|
||
subm_conv2d | ||
------------------------------- | ||
|
||
.. py:function:: paddle.sparse.nn.functional.subm_conv2d(x, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, data_format='NHWC', key=None, name=None) | ||
|
||
稀疏子流形二维卷积函数根据输入卷积核计算输出以及步长(stride)、填充(padding)、空洞大小(dilations)一组参数。 | ||
输入(Input)和输出(Output)是多维稀疏张量(SparseCooTensors), 其形状为 :math:`[N, H, W, C]` 。 | ||
其中 N 是批次大小, C 是通道数, H 是特征的高度, W 是特征的宽度。 | ||
如果提供了偏差归因,则将偏差添加到卷积的输出中。 | ||
|
||
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. 一些名词描述上,可以参考下 https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Conv2D_cn.html#conv2d文档,名词与其保持一致。例如: |
||
对于每一个输入 :math:`X`, 其计算公式为: | ||
|
||
.. math:: | ||
Out = \sigma (W \ast X + b) | ||
在上面的等式中: | ||
|
||
* :math:`X`: 输入值, NHWC 格式的张量。 | ||
* :math:`W`: 卷积核值, NHWC 格式的张量。 | ||
* :math:`\\ast`: 子流形卷积操作,参考论文: https://arxiv.org/abs/1706.01307. | ||
* :math:`b`: 偏置值, 形状为[M]的一维张量。 | ||
* :math:`Out`: 输出值, :math:`Out` 的形状可能和 :math:`X` 有不同。 | ||
|
||
|
||
参数 | ||
:::::::::: | ||
|
||
- x (Tensor): 输入是形状为 [N, H, W, C] 的四维稀疏张量, 输入数据类型为 float16、float32 或 float64。 | ||
- weight (Tensor): 形状为 [kH, kW, C/g, M] 的卷积核,其中 M 是卷积核(输出通道)的数量, g 是组的数量, kD、kH、kW 分别是卷积核的高度和宽度。 | ||
- bias (Tensor, optional): 偏差, 形状为 [M] 的张量。 | ||
- 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]'。 | ||
当 '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)。 | ||
否则, dilation_height = dilation_width = dilation。 | ||
dilation 的默认值为 1。 | ||
- groups (int, optional): 二维卷积层的组号。根据 Alex Krizhevsky 的 Deep CNN 论文中的卷积分组: | ||
当 group=2 时,卷积核的前半部分仅连接到前半部分的输入通道,而卷积核的后半部分仅连接到输入通道的后半部分。 | ||
groups 的默认值为 1。目前, 只有 support groups=1。 | ||
- data_format (str, optional): 指定输入的数据格式和输出的数据格式将与输入一致。即 `"NHWC"` 的可选字符串。默认值为 `"NHWC"`。 | ||
当它是 `"NHWC"` 时, 数据按以下顺序存储:`[batch_size, input_height, input_width, input_channels]`。 | ||
- key(str, optional):用于保存或使用相同规则手册的密钥,规则手册的定义和作用是指 https://pdfs.semanticscholar.org/5125/a16039cabc6320c908a4764f32596e018ad3.pdf。默认值为 None。 | ||
- name(str, optional):有关详细信息,请参阅到 :ref:`api_guide_Name`。通常名称是不需要设置的, 并且默认情况下为空。 | ||
|
||
|
||
返回 | ||
:::::::::: | ||
|
||
- 表示二维卷积的多维稀疏张量(SparseCooTenstor), 其数据类型与输入相同。 | ||
|
||
|
||
代码示例 | ||
:::::::::: | ||
|
||
COPY-FROM: paddle.sparse.nn.functional.subm_conv2d |
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.
整体可以参考 subm_conv2d,看看对应的英文翻译是否准确