• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1mindspore.mint.nn.functional.linear
2======================================
3
4.. py:function:: mindspore.mint.nn.functional.linear(input, weight, bias=None)
5
6    对输入 `input` 应用全连接操作。全连接定义为:
7
8    .. math::
9        output = input * weight^{T} + bias
10
11    .. warning::
12        这是一个实验性API,后续可能修改或删除。
13
14    参数:
15        - **input** (Tensor) - 输入Tensor,shape是 :math:`(*, in\_channels)`,其中 :math:`*` 表示任意的附加维度。
16        - **weight** (Tensor) - 输入Tensor的权重,shape是 :math:`(out\_channels, in\_channels)` 或 :math:`(in\_channels)`。
17        - **bias** (Tensor,可选) - 添加在输出结果的偏差,shape是 :math:`(out\_channels)` 或 :math:`()`。默认值:``None`` ,偏差为0。
18
19    返回:
20        输出结果,shape由 `input` 和 `weight` 的shape决定。
21
22    异常:
23        - **TypeError** - `input` 不是Tensor。
24        - **TypeError** - `weight` 不是Tensor。
25        - **TypeError** - `bias` 不是Tensor。
26