Skip to content

Commit 2854d27

Browse files
[Docathon][Add CN Doc No.4-5] (#6362)
* add docs * Update docs/api/paddle/incubate/nn/functional/fused_matmul_bias_cn.rst Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * Update FusedLinear_cn.rst * Update fused_matmul_bias_cn.rst * Update fused_matmul_bias_cn.rst * Update FusedLinear_cn.rst --------- Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
1 parent c756c4d commit 2854d27

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. _cn_api_paddle_incubate_nn_FusedLinear:
2+
3+
FusedLinear
4+
-------------------------------
5+
6+
.. py:class:: paddle.incubate.nn.FusedLinear(in_features, out_features, weight_attr=None, bias_attr=None, transpose_weight=False, name=None)
7+
8+
FusedLinear 层只接受一个 Tensor 作为输入,形状为 :math:`[batch\_size, *, in\_features]`,其中 :math:`*` 表示可以为任意个额外的维度。
9+
该层可以计算输入 Tensor 与权重矩阵 :math:`W` 的乘积,然后生成形状为 :math:`[batch\_size, *, out\_features]` 的输出 Tensor。
10+
如果 :math:`bias\_attr` 不是 False,则将创建一个偏置参数并将其添加到输出中。此方法要求 CUDA 版本不低于 11.6。
11+
12+
参数
13+
::::::::::::
14+
- **in_features** (int) – 线性变换层输入单元的数目。
15+
- **out_features** (int) – 线性变换层输出单元的数目。
16+
- **weight_attr** (ParamAttr,可选) - 指定权重参数的属性。默认值为 None,权重将初始化为零。具体用法请参见 :ref:`cn_api_paddle_ParamAttr` 。
17+
- **transpose_weight** (bool) - 在乘积运算前是否转置 `weight` 张量。
18+
- **bias_attr** (ParamAttr|bool,可选) – 指定偏置参数的属性。:math:`bias\_attr` 为 bool 类型且设置为 False 时,表示不会为该层添加偏置。:math:`bias\_attr` 如果设置为 True 或者 None,则表示使用默认的偏置参数属性,将偏置参数初始化为 0。具体用法请参见 :ref:`cn_api_paddle_ParamAttr`。默认值为 None。
19+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
20+
21+
属性
22+
:::::::::
23+
24+
weight
25+
'''''''''
26+
27+
本层的可学习参数,类型为 ``Parameter`` 。
28+
29+
bias
30+
'''''''''
31+
32+
本层的可学习偏置,类型为 ``Parameter`` 。
33+
34+
形状
35+
:::::::::
36+
37+
- 输入:形状为 :math:`[batch\_size, *, in\_features]` 的多维 Tensor。
38+
- 输出:形状为 :math:`[batch\_size, *, out\_features]` 的多维 Tensor。
39+
40+
代码示例
41+
:::::::::
42+
43+
COPY-FROM: paddle.incubate.nn.FusedLinear
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _cn_api_paddle_incubate_nn_functional_fused_matmul_bias:
2+
3+
fused_matmul_bias
4+
-------------------------------
5+
6+
.. py:function:: paddle.incubate.nn.functional.fused_matmul_bias(x, y, bias=None, transpose_x=False, transpose_y=False, name=None)
7+
8+
应用两个张量的矩阵乘法,然后如果提供了偏置,进行偏置加法。
9+
10+
此方法要求 CUDA 版本不低于 11.6。
11+
12+
参数
13+
::::::::::::
14+
- **x** (Tensor) - 第一个输入 ``Tensor``,被乘 ``Tensor``。
15+
- **y** (Tensor) - 第二个输入 ``Tensor``,被乘 ``Tensor``。其秩必须为 2。
16+
- **bias** (Tensor,可选) - 输入的偏置。如果为 None,则不执行偏置加法。否则,偏置将被加到矩阵乘法结果上。默认:None。
17+
- **transpose_x** (bool,可选) - 是否在乘积运算前转置 :math:`x`。默认:False。
18+
- **transpose_y** (bool,可选) - 是否在乘积运算前转置 :math:`y`。默认:False。
19+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
20+
21+
返回
22+
::::::::::::
23+
输出 ``Tensor`
24+
25+
代码示例
26+
::::::::::::
27+
28+
COPY-FROM: paddle.incubate.nn.functional.fused_matmul_bias

0 commit comments

Comments
 (0)