Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
dd613047
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看板
提交
dd613047
编写于
4月 07, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine annotation
上级
a5734f7c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
16 deletion
+20
-16
paddle/gserver/layers/SequenceLastInstanceLayer.cpp
paddle/gserver/layers/SequenceLastInstanceLayer.cpp
+4
-2
paddle/gserver/layers/SequencePoolLayer.h
paddle/gserver/layers/SequencePoolLayer.h
+4
-4
paddle/parameter/Argument.cpp
paddle/parameter/Argument.cpp
+1
-1
paddle/parameter/Argument.h
paddle/parameter/Argument.h
+1
-1
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+10
-8
未找到文件。
paddle/gserver/layers/SequenceLastInstanceLayer.cpp
浏览文件 @
dd613047
...
...
@@ -26,8 +26,10 @@ namespace paddle {
* If SequenceLevel = kNonseq:
* Output: a sequence containing only the last instance of the input sequence
* If stride_ > 0:
* Output: a shorten sequence containing several last instances of the
* input sequence with stride window.
* Output: a shorten sequence. The operation of getting last instance of a
* sequence is independently performed on every slice of the input
* sequence, which is obtained by sliding a window with the window
* size set to stride_.
* If SequenceLevel = kSeq:
* Check input sequence must has sub-sequence
* Output: a sequence containing only the last instance of each sub-sequence
...
...
paddle/gserver/layers/SequencePoolLayer.h
浏览文件 @
dd613047
...
...
@@ -27,9 +27,9 @@ namespace paddle {
* output[i] = seqlastin/average/max_{for each instance in this
* sequence}{input[i]}
* If stride_ > 0:
* Check input sequence must
don'
t have sub-sequence
* Check input sequence must
no
t have sub-sequence
* Output: a shorten sequence, pooling is performed upon a small local
* area
*
area
* If SequenceLevel = kSeq:
* Check input sequence must has sub-sequence
* Output: output size is the number of input sub-sequences
...
...
@@ -47,9 +47,9 @@ protected:
size_t
newBatchSize_
;
ICpuGpuVectorPtr
startPositions_
;
int
stride_
;
// store the start position of each
stride
window
// store the start position of each window
IVectorPtr
stridePositions_
;
// Whether
it is reversed sequence
// Whether
the input sequence is reversed or not
bool
reversed_
=
false
;
public:
...
...
paddle/parameter/Argument.cpp
浏览文件 @
dd613047
...
...
@@ -589,7 +589,7 @@ void Argument::poolSequenceWithStride(const Argument& input,
}
else
{
int
size
=
ceil
((
float
)
seqLength
/
stride
);
tgtBuf
[
seqId
+
1
]
=
tgtBuf
[
seqId
]
+
size
;
for
(
int
i
=
0
;
i
<
size
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
-
1
;
++
i
)
{
int
cur
=
reversed
?
starts
[
seqId
+
1
]
-
(
size
-
1
-
i
)
*
stride
:
stridePos
.
back
()
+
stride
;
stridePos
.
emplace_back
(
cur
);
...
...
paddle/parameter/Argument.h
浏览文件 @
dd613047
...
...
@@ -294,7 +294,7 @@ struct Argument {
/*
After pooling with stride n (n is smaller than sequence length),
a long sequence will be shorten.
This function is
not suitable for sequence with sub-sequence now
.
This function is
invalid for sequence having sub-sequence
.
*/
void
poolSequenceWithStride
(
const
Argument
&
input
,
size_t
stride
,
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
dd613047
...
...
@@ -1347,9 +1347,10 @@ def last_seq(input,
"""
Get Last Timestamp Activation of a sequence.
If stride > 0, get last timestamp upon a stride window of sequence.
And a long sequence will be shorten. Note that for sequence with
sub-sequence, stride is default -1 now.
If stride > 0, this layer slides a window whose size is determined by stride,
and return the last value of the window as the output. Thus, a long sequence
will be shorten. Note that for sequence with sub-sequence, the default value
of stride is -1.
The simple usage is:
...
...
@@ -1362,7 +1363,7 @@ def last_seq(input,
:type name: basestring
:param input: Input layer name.
:type input: LayerOutput
:param stride:
parameter of stride window
.
:param stride:
window size
.
:type stride: Int
:param layer_attr: extra layer attributes.
:type layer_attr: ExtraLayerAttribute.
...
...
@@ -1402,9 +1403,10 @@ def first_seq(input,
"""
Get First Timestamp Activation of a sequence.
If stride > 0, get first timestamp upon a stride window of sequence,
and a long sequence will be shorten. Note that for sequence with
sub-sequence, stride is default -1 now.
If stride > 0, this layer slides a window whose size is determined by stride,
and return the first value of the window as the output. Thus, a long sequence
will be shorten. Note that for sequence with sub-sequence, the default value
of stride is -1.
The simple usage is:
...
...
@@ -1417,7 +1419,7 @@ def first_seq(input,
:type name: basestring
:param input: Input layer name.
:type input: LayerOutput
:param stride:
parameter of stride window
.
:param stride:
window size
.
:type stride: Int
:param layer_attr: extra layer attributes.
:type layer_attr: ExtraLayerAttribute.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录