Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
c322c7bb
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c322c7bb
编写于
12月 20, 2017
作者:
C
caoying03
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some small refines.
上级
66468736
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
27 deletion
+29
-27
paddle/operators/mul_op.cc
paddle/operators/mul_op.cc
+15
-16
python/paddle/v2/fluid/layers/nn.py
python/paddle/v2/fluid/layers/nn.py
+14
-11
未找到文件。
paddle/operators/mul_op.cc
浏览文件 @
c322c7bb
...
@@ -81,15 +81,15 @@ class MulOpMaker : public framework::OpProtoAndCheckerMaker {
...
@@ -81,15 +81,15 @@ class MulOpMaker : public framework::OpProtoAndCheckerMaker {
"(int, default 1) "
"(int, default 1) "
R"DOC(The mul_op can take tensors with more than two dimensions as its
R"DOC(The mul_op can take tensors with more than two dimensions as its
inputs. If the input `X` is a tensor with more than two
inputs. If the input `X` is a tensor with more than two
dimensions, `X` will be flatten into a two-dimensional matrix
dimensions, `X` will be flatten
ed
into a two-dimensional matrix
first. The flatten rule is: the first `num_col_dims` will be
first. The flatten
ing
rule is: the first `num_col_dims` will be
flatten
to form the first dimension of the matrix (height of the
flatten
ed to form the first dimension of the final matrix (height
matrix), and the rest `rank(X) - num_col_dims` dimensions are
of the matrix), and the rest `rank(X) - num_col_dims` dimensions
flattened to form the second dimension of the matrix (width of the
are flattened to form the second dimension of the final matrix (
matrix). As a result, height of the flattened matrix is equal to
width of the matrix). As a result, height of the flattened matrix
the product of `X`'s first `x_num_col_dims` dimensions' sizes,
is equal to the product of `X`'s first `x_num_col_dims` dimensions'
and width of the flattened matrix is equal to the product of `X`'s
sizes, and width of the flattened matrix is equal to the product
last `rank(x) - num_col_dims` dimensions' size.
of `X`'s
last `rank(x) - num_col_dims` dimensions' size.
For example, suppose `X` is a 6-dimensional tensor with the shape
For example, suppose `X` is a 6-dimensional tensor with the shape
[2, 3, 4, 5, 6], and `x_num_col_dims` = 3. Then, the flattened
[2, 3, 4, 5, 6], and `x_num_col_dims` = 3. Then, the flattened
matrix will have a shape [2 x 3 x 4, 5 x 6] = [24, 30].
matrix will have a shape [2 x 3 x 4, 5 x 6] = [24, 30].
...
@@ -102,9 +102,8 @@ class MulOpMaker : public framework::OpProtoAndCheckerMaker {
...
@@ -102,9 +102,8 @@ class MulOpMaker : public framework::OpProtoAndCheckerMaker {
R"DOC(The mul_op can take tensors with more than two dimensions as its
R"DOC(The mul_op can take tensors with more than two dimensions as its
inputs. If the input `Y` is a tensor with more than two
inputs. If the input `Y` is a tensor with more than two
dimensions, `Y` will be flatten into a two-dimensional matrix
dimensions, `Y` will be flatten into a two-dimensional matrix
first. The attribute `y_num_col_dims` is used to flatten `Y` into
first. The attribute `y_num_col_dims` determines how `Y` is
a two-dimensional matrix. See the comments of `x_num_col_dims` for
flattened. See comments of `x_num_col_dims` for more details.
more details.
)DOC"
)
)DOC"
)
.
SetDefault
(
1
)
.
SetDefault
(
1
)
.
EqualGreaterThan
(
1
);
.
EqualGreaterThan
(
1
);
...
...
python/paddle/v2/fluid/layers/nn.py
浏览文件 @
c322c7bb
...
@@ -55,24 +55,27 @@ def fc(input,
...
@@ -55,24 +55,27 @@ def fc(input,
act: Activation to be applied to the output of the fully connected layer.
act: Activation to be applied to the output of the fully connected layer.
name: Name/alias of the fully connected layer.
name: Name/alias of the fully connected layer.
The fully connected can take multiple tensor as inputs. It creates a
The fully connected layer can take multiple tensors as its inputs. It
variable (one for each input tensor) called weights which represents a
creates a variable (one for each input tensor) called weights for each input
fully connected weight matrix from each input unit to each output unit.
tensor, which represents a fully connected weight matrix from each input
The fully connected layer multiplies each input tensor with its coresponding
unit to each output unit. The fully connected layer multiplies each input
weight to produce an output Tensor. If multiple input tensors are given,
tensor with its coresponding weight to produce an output Tensor. If
the results of multiple multiplications will be sumed up. If bias_attr is
multiple input tensors are given, the results of multiple multiplications
not None, a biases variable will be created and added to the output.
will be sumed up. If bias_attr is not None, a biases variable will be
Finally, if activation is not None, it will be applied to the output as well.
created and added to the output. Finally, if activation is not None,
it will be applied to the output as well.
This process canbe formulated as follows:
This process can be formulated as follows:
.. math::
.. math::
Y = \sigma({\sum_{i=0}^{N-1}W_iX_i + b})
Y = \sigma({\sum_{i=0}^{N-1}W_iX_i + b})
where, :math:`N` is the number of input, :math:`X_i` is the input tensor,
where, :math:`N` is the number of input, :math:`X_i` is the input tensor,
:math`W` is the weights created by this layer, :math:`b` is the bias.
:math:`W` is the weights created by this layer, :math:`b` is the bias
created by this layer (if needed), :math:`\sigma` is the activation funtion.
"""
"""
helper
=
LayerHelper
(
"fc"
,
**
locals
())
helper
=
LayerHelper
(
"fc"
,
**
locals
())
dtype
=
helper
.
input_dtype
()
dtype
=
helper
.
input_dtype
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录