Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
fc0f92c2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fc0f92c2
编写于
3月 14, 2018
作者:
R
ranqiu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update api doc std and fc doc
上级
a78b7602
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
46 deletion
+30
-46
doc/fluid/dev/api_doc_std_cn.md
doc/fluid/dev/api_doc_std_cn.md
+3
-2
doc/fluid/dev/src/fc.py
doc/fluid/dev/src/fc.py
+2
-1
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+25
-43
未找到文件。
doc/fluid/dev/api_doc_std_cn.md
浏览文件 @
fc0f92c2
...
@@ -40,7 +40,7 @@ API文档须包含以下几个模块(排列顺序为文档撰写顺序):
...
@@ -40,7 +40,7 @@ API文档须包含以下几个模块(排列顺序为文档撰写顺序):
## 格式及示例
## 格式及示例
API文档须使用r
s
t格式撰写,该格式详情请参考
[
链接
](
http://sphinx-doc-zh.readthedocs.io/en/latest/rest.html
)
。API文档各模块的内容格式及示例如下(以下以fc为例进行说明):
API文档须使用r
eStructuredTex
t格式撰写,该格式详情请参考
[
链接
](
http://sphinx-doc-zh.readthedocs.io/en/latest/rest.html
)
。API文档各模块的内容格式及示例如下(以下以fc为例进行说明):
-
Python API Definition
-
Python API Definition
...
@@ -137,7 +137,8 @@ API文档须使用rst格式撰写,该格式详情请参考[链接](http://sphi
...
@@ -137,7 +137,8 @@ API文档须使用rst格式撰写,该格式详情请参考[链接](http://sphi
```
```
Args:
Args:
input (Variable|list of Variable): This layer's input tensor(s) which is at least 2-dimensional.
input (Variable|list of Variable): The input tensor(s) of this layer, and the dimension of
the input tensor(s) is at least 2.
param_attr (ParamAttr|list of ParamAttr, default None): The parameter attribute for learnable
param_attr (ParamAttr|list of ParamAttr, default None): The parameter attribute for learnable
parameters/weights of this layer.
parameters/weights of this layer.
name (str, default None): The name of this layer.
name (str, default None): The name of this layer.
...
...
doc/fluid/dev/src/fc.py
浏览文件 @
fc0f92c2
...
@@ -48,7 +48,8 @@ def fc(input,
...
@@ -48,7 +48,8 @@ def fc(input,
* :math:`Out`: The output tensor.
* :math:`Out`: The output tensor.
Args:
Args:
input (Variable|list of Variable): This layer's input tensor(s) which is at least 2-dimensional.
input (Variable|list of Variable): The input tensor(s) of this layer, and the dimension of
the input tensor(s) is at least 2.
size(int): The number of output units in this layer.
size(int): The number of output units in this layer.
num_flatten_dims (int, default 1): The fc layer can accept an input tensor with more than
num_flatten_dims (int, default 1): The fc layer can accept an input tensor with more than
two dimensions. If this happens, the multidimensional tensor will first be flattened
two dimensions. If this happens, the multidimensional tensor will first be flattened
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
fc0f92c2
...
@@ -85,13 +85,12 @@ def fc(input,
...
@@ -85,13 +85,12 @@ def fc(input,
**Fully Connected Layer**
**Fully Connected Layer**
The fully connected layer can take multiple tensors as its inputs. It
The fully connected layer can take multiple tensors as its inputs. It
creates a variable (one for each input tensor) called weights for each
creates a variable called weights for each input tensor, which represents
input tensor, which represents a fully connected weight matrix from
a fully connected weight matrix from each input unit to each output unit.
each input unit to each output unit. The fully connected layer
The fully connected layer multiplies each input tensor with its coresponding
multiplies each input tensor with its coresponding weight to produce
weight to produce an output Tensor. If multiple input tensors are given,
an output Tensor. If multiple input tensors are given, the results of
the results of multiple multiplications will be sumed up. If bias_attr is
multiple multiplications will be sumed up. If bias_attr is not None,
not None, a bias variable will be created and added to the output. Finally,
a biases variable will be created and added to the output. Finally,
if activation is not None, it will be applied to the output as well.
if activation is not None, it will be applied to the output as well.
This process can be formulated as follows:
This process can be formulated as follows:
...
@@ -110,44 +109,27 @@ def fc(input,
...
@@ -110,44 +109,27 @@ def fc(input,
* :math:`Out`: The output tensor.
* :math:`Out`: The output tensor.
Args:
Args:
input(Variable|list): The input tensor(s) to the fully connected layer.
input (Variable|list of Variable): The input tensor(s) of this layer, and the dimension of
size(int): The number of output units in the fully connected layer.
the input tensor(s) is at least 2.
num_flatten_dims(int): The fc layer can accept an input tensor with more
size(int): The number of output units in this layer.
than two dimensions. If this happens, the
num_flatten_dims (int, default 1): The fc layer can accept an input tensor with more than
multidimensional tensor will first be flattened
two dimensions. If this happens, the multidimensional tensor will first be flattened
into a 2-dimensional matrix. The parameter
into a 2-dimensional matrix. The parameter `num_flatten_dims` determines how the input
`num_flatten_dims` determines how the input tensor
tensor is flattened: the first `num_flatten_dims` (inclusive, index starts from 1)
is flattened: the first `num_flatten_dims`
dimensions will be flatten to form the first dimension of the final matrix (height of
(inclusive, index starts from 1) dimensions will
the matrix), and the rest `rank(X) - num_flatten_dims` dimensions are flattened to
be flatten to form the first dimension of the
form the second dimension of the final matrix (width of the matrix). For example, suppose
final matrix (height of the matrix), and the rest
`X` is a 6-dimensional tensor with a shape [2, 3, 4, 5, 6], and `num_flatten_dims` = 3.
`rank(X) - num_flatten_dims` dimensions are
Then, the flattened matrix will have a shape [2 x 3 x 4, 5 x 6] = [24, 30].
flattened to form the second dimension of the
param_attr (ParamAttr|list of ParamAttr, default None): The parameter attribute for learnable
final matrix (width of the matrix). For example,
parameters/weights of this layer.
suppose `X` is a 6-dimensional tensor with a shape
bias_attr (ParamAttr|list of ParamAttr, default None): The parameter attribute for the bias
[2, 3, 4, 5, 6], and `num_flatten_dims` = 3. Then,
of this layer. If it is set to None, no bias will be added to the output units.
the flattened matrix will have a shape
act (str, default None): Activation to be applied to the output of this layer.
[2 x 3 x 4, 5 x 6] = [24, 30]. By default,
name (str, default None): The name of this layer.
`num_flatten_dims` is set to 1.
param_attr(ParamAttr|list): The parameter attribute for learnable
parameters/weights of the fully connected
layer.
param_initializer(ParamAttr|list): The initializer used for the
weight/parameter. If set None,
XavierInitializer() will be used.
bias_attr(ParamAttr|list): The parameter attribute for the bias parameter
for this layer. If set None, no bias will be
added to the output units.
bias_initializer(ParamAttr|list): The initializer used for the bias.
If set None, then ConstantInitializer()
will be used.
act(str): Activation to be applied to the output of the fully connected
layer.
name(str): Name/alias of the fully connected layer.
Returns:
Returns:
Variable: The output tensor variable
.
A tensor variable storing the transformation result
.
Raises:
Raises:
ValueError: If rank of the input tensor is less than 2.
ValueError: If rank of the input tensor is less than 2.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录