Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c2dea5a8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
c2dea5a8
编写于
9月 18, 2017
作者:
R
ranqiu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update the annotation of layers.py
上级
8be9930f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
27 deletion
+40
-27
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+40
-27
未找到文件。
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
c2dea5a8
...
@@ -5457,9 +5457,9 @@ def nce_layer(input,
...
@@ -5457,9 +5457,9 @@ def nce_layer(input,
param_attr=[attr1, attr2], weight=layer3,
param_attr=[attr1, attr2], weight=layer3,
num_classes=3, neg_distribution=[0.1,0.3,0.6])
num_classes=3, neg_distribution=[0.1,0.3,0.6])
:param name:
layer name
:param name:
The name of this layer.
:type name: basestring
:type name: basestring
:param input: input layers. It could be a LayerOutput of list/tuple of LayerOutput.
:param input:
The
input layers. It could be a LayerOutput of list/tuple of LayerOutput.
:type input: LayerOutput|list|tuple|collections.Sequence
:type input: LayerOutput|list|tuple|collections.Sequence
:param label: label layer
:param label: label layer
:type label: LayerOutput
:type label: LayerOutput
...
@@ -5477,7 +5477,9 @@ def nce_layer(input,
...
@@ -5477,7 +5477,9 @@ def nce_layer(input,
A uniform distribution will be used if not provided.
A uniform distribution will be used if not provided.
If not None, its length must be equal to num_classes.
If not None, its length must be equal to num_classes.
:type neg_distribution: list|tuple|collections.Sequence|None
:type neg_distribution: list|tuple|collections.Sequence|None
:param bias_attr: Bias parameter attribute. True if no bias.
:param bias_attr: The Bias Attribute. If no bias, then pass False or
something not type of ParameterAttribute. None will get a
default Bias.
:type bias_attr: ParameterAttribute|None|False
:type bias_attr: ParameterAttribute|None|False
:param layer_attr: Extra Layer Attribute.
:param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
...
@@ -5593,7 +5595,7 @@ def rank_cost(left,
...
@@ -5593,7 +5595,7 @@ def rank_cost(left,
:param weight: The weight affects the cost, namely the scale of cost.
:param weight: The weight affects the cost, namely the scale of cost.
It is an optional argument.
It is an optional argument.
:type weight: LayerOutput
:type weight: LayerOutput
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring
:type name: None|basestring
:param coeff: The coefficient affects the gradient in the backward.
:param coeff: The coefficient affects the gradient in the backward.
:type coeff: float
:type coeff: float
...
@@ -5647,7 +5649,7 @@ def lambda_cost(input,
...
@@ -5647,7 +5649,7 @@ def lambda_cost(input,
:param score: The 2nd input. Score of each sample.
:param score: The 2nd input. Score of each sample.
:type input: LayerOutput
:type input: LayerOutput
:param NDCG_num: The size of NDCG (Normalized Discounted Cumulative Gain),
:param NDCG_num: The size of NDCG (Normalized Discounted Cumulative Gain),
e.g., 5 for NDCG@5. It must be less than
f
or equal to the
e.g., 5 for NDCG@5. It must be less than or equal to the
minimum size of lists.
minimum size of lists.
:type NDCG_num: int
:type NDCG_num: int
:param max_sort_size: The size of partial sorting in calculating gradient.
:param max_sort_size: The size of partial sorting in calculating gradient.
...
@@ -5658,7 +5660,7 @@ def lambda_cost(input,
...
@@ -5658,7 +5660,7 @@ def lambda_cost(input,
than the size of a list, the algorithm will sort the
than the size of a list, the algorithm will sort the
entire list of get gradient.
entire list of get gradient.
:type max_sort_size: int
:type max_sort_size: int
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring
:type name: None|basestring
:param layer_attr: Extra Layer Attribute.
:param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
...
@@ -5702,7 +5704,7 @@ def cross_entropy(input,
...
@@ -5702,7 +5704,7 @@ def cross_entropy(input,
:type input: LayerOutput.
:type input: LayerOutput.
:param label: The input label.
:param label: The input label.
:type input: LayerOutput.
:type input: LayerOutput.
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring.
:type name: None|basestring.
:param coeff: The cost is multiplied with coeff.
:param coeff: The cost is multiplied with coeff.
The coefficient affects the gradient in the backward.
The coefficient affects the gradient in the backward.
...
@@ -5750,7 +5752,7 @@ def cross_entropy_with_selfnorm(input,
...
@@ -5750,7 +5752,7 @@ def cross_entropy_with_selfnorm(input,
:type input: LayerOutput.
:type input: LayerOutput.
:param label: The input label.
:param label: The input label.
:type input: LayerOutput.
:type input: LayerOutput.
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring.
:type name: None|basestring.
:param coeff: The coefficient affects the gradient in the backward.
:param coeff: The coefficient affects the gradient in the backward.
:type coeff: float.
:type coeff: float.
...
@@ -5790,7 +5792,7 @@ def sum_cost(input, name=None, layer_attr=None):
...
@@ -5790,7 +5792,7 @@ def sum_cost(input, name=None, layer_attr=None):
:param input: The first input layer.
:param input: The first input layer.
:type input: LayerOutput.
:type input: LayerOutput.
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring.
:type name: None|basestring.
:param layer_attr: Extra Layer Attribute.
:param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
...
@@ -5835,7 +5837,7 @@ def huber_regression_cost(input,
...
@@ -5835,7 +5837,7 @@ def huber_regression_cost(input,
:type input: LayerOutput.
:type input: LayerOutput.
:param label: The input label.
:param label: The input label.
:type input: LayerOutput.
:type input: LayerOutput.
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring.
:type name: None|basestring.
:param delta: The difference between the observed and predicted values.
:param delta: The difference between the observed and predicted values.
:type delta: float.
:type delta: float.
...
@@ -5885,7 +5887,7 @@ def huber_classification_cost(input,
...
@@ -5885,7 +5887,7 @@ def huber_classification_cost(input,
:type input: LayerOutput.
:type input: LayerOutput.
:param label: The input label.
:param label: The input label.
:type input: LayerOutput.
:type input: LayerOutput.
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring.
:type name: None|basestring.
:param coeff: The coefficient affects the gradient in the backward.
:param coeff: The coefficient affects the gradient in the backward.
:type coeff: float.
:type coeff: float.
...
@@ -5928,7 +5930,7 @@ def multi_binary_label_cross_entropy(input,
...
@@ -5928,7 +5930,7 @@ def multi_binary_label_cross_entropy(input,
:type input: LayerOutput
:type input: LayerOutput
:param label: The input label.
:param label: The input label.
:type input: LayerOutput
:type input: LayerOutput
:param name: The name of this layer
s
. It is not necessary.
:param name: The name of this layer. It is not necessary.
:type name: None|basestring
:type name: None|basestring
:param coeff: The coefficient affects the gradient in the backward.
:param coeff: The coefficient affects the gradient in the backward.
:type coeff: float
:type coeff: float
...
@@ -6033,9 +6035,9 @@ def cross_entropy_over_beam(input, name=None):
...
@@ -6033,9 +6035,9 @@ def cross_entropy_over_beam(input, name=None):
])
])
:param input:
i
nput beams for this layer.
:param input:
I
nput beams for this layer.
:type input: BeamInput
:type input: BeamInput
:param name:
input beams for
this layer.
:param name:
The name of
this layer.
:type name: basestring
:type name: basestring
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
...
@@ -6175,12 +6177,21 @@ def multiplex_layer(input, name=None, layer_attr=None):
...
@@ -6175,12 +6177,21 @@ def multiplex_layer(input, name=None, layer_attr=None):
@
wrap_name_default
(
"dropout"
)
@
wrap_name_default
(
"dropout"
)
def
dropout_layer
(
input
,
dropout_rate
,
name
=
None
):
def
dropout_layer
(
input
,
dropout_rate
,
name
=
None
):
"""
"""
@TODO(yuyang18): Add comments.
:param name:
The example usage is:
:param input:
:param dropout_rate:
.. code-block:: python
:return:
dropout = dropout_layer(input=input_layer, dropout_rate=0.5)
:param name: The name of this layer.
:type name: basestring
:param input: The input layer.
:type input: LayerOutput
:param dropout_rate: The probability of dropout.
:type dropout_rate: float
:return: LayerOutput object.
:rtype: LayerOutput
"""
"""
return
addto_layer
(
return
addto_layer
(
name
=
name
,
name
=
name
,
...
@@ -6203,7 +6214,7 @@ def row_conv_layer(input,
...
@@ -6203,7 +6214,7 @@ def row_conv_layer(input,
"""
"""
The row convolution is called lookahead convolution. It is firstly
The row convolution is called lookahead convolution. It is firstly
introduced in paper of `Deep Speech 2: End-toEnd Speech Recognition
introduced in paper of `Deep Speech 2: End-to
-
End Speech Recognition
in English and Mandarin <https://arxiv.org/pdf/1512.02595v1.pdf>`_ .
in English and Mandarin <https://arxiv.org/pdf/1512.02595v1.pdf>`_ .
The bidirectional RNN that learns representation for a sequence by
The bidirectional RNN that learns representation for a sequence by
...
@@ -6211,9 +6222,9 @@ def row_conv_layer(input,
...
@@ -6211,9 +6222,9 @@ def row_conv_layer(input,
However, unlike unidirectional RNNs, bidirectional RNNs are challenging
However, unlike unidirectional RNNs, bidirectional RNNs are challenging
to deploy in an online and low-latency setting. The lookahead convolution
to deploy in an online and low-latency setting. The lookahead convolution
incorporates information from future subsequences in a computationally
incorporates information from future subsequences in a computationally
efficient manner to improve unidirectional
recurrent neural network
s.
efficient manner to improve unidirectional
RNN
s.
The connection of row convolution is different f
or
m the 1D sequence
The connection of row convolution is different f
ro
m the 1D sequence
convolution. Assumed that, the future context-length is k, that is to say,
convolution. Assumed that, the future context-length is k, that is to say,
it can get the output at timestep t by using the the input feature from t-th
it can get the output at timestep t by using the the input feature from t-th
timestep to (t+k+1)-th timestep. Assumed that the hidden dim of input
timestep to (t+k+1)-th timestep. Assumed that the hidden dim of input
...
@@ -6242,7 +6253,7 @@ def row_conv_layer(input,
...
@@ -6242,7 +6253,7 @@ def row_conv_layer(input,
:param act: Activation Type. Default is linear activation.
:param act: Activation Type. Default is linear activation.
:type act: BaseActivation
:type act: BaseActivation
:param param_attr: The Parameter Attribute. If None, the parameter will be
:param param_attr: The Parameter Attribute. If None, the parameter will be
initialized smartly. It's better set it by yourself.
initialized smartly. It's better
to
set it by yourself.
:type param_attr: ParameterAttribute
:type param_attr: ParameterAttribute
:param layer_attr: Extra Layer config.
:param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None
:type layer_attr: ExtraLayerAttribute|None
...
@@ -6342,7 +6353,7 @@ def gated_unit_layer(input,
...
@@ -6342,7 +6353,7 @@ def gated_unit_layer(input,
The gated unit layer implements a simple gating mechanism over the input.
The gated unit layer implements a simple gating mechanism over the input.
The input :math:`X` is first projected into a new space :math:`X'`, and
The input :math:`X` is first projected into a new space :math:`X'`, and
it is also used to produce a gate weight :math:`\sigma`. Element-wise
it is also used to produce a gate weight :math:`\sigma`. Element-wise
prod
i
ct between :match:`X'` and :math:`\sigma` is finally returned.
prod
u
ct between :match:`X'` and :math:`\sigma` is finally returned.
Reference:
Reference:
Language Modeling with Gated Convolutional Networks
Language Modeling with Gated Convolutional Networks
...
@@ -6440,8 +6451,8 @@ def switch_order_layer(input,
...
@@ -6440,8 +6451,8 @@ def switch_order_layer(input,
:type input: LayerOutput
:type input: LayerOutput
:param name: Name of this layer.
:param name: Name of this layer.
:type name: basestring
:type name: basestring
:param reshape
: reshape matrix by axises
.
:param reshape
_axis: Specify the axises of 'height'. Its value should be positive and less than 4
.
:type reshape
: Dic
t
:type reshape
_axis: in
t
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
"""
"""
...
@@ -6869,7 +6880,9 @@ def scale_shift_layer(input, name=None, param_attr=None, bias_attr=None):
...
@@ -6869,7 +6880,9 @@ def scale_shift_layer(input, name=None, param_attr=None, bias_attr=None):
:type input: LayerOutput.
:type input: LayerOutput.
:param param_attr: The parameter attribute of scaling.
:param param_attr: The parameter attribute of scaling.
:type param_attr: ParameterAttribute
:type param_attr: ParameterAttribute
:param bias_attr: The parameter attribute of shifting.
:param bias_attr: The Bias Attribute. If no bias, then pass False or
something not type of ParameterAttribute. None will get a
default Bias.
:type bias_attr: ParameterAttribute
:type bias_attr: ParameterAttribute
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录