Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
64fe9bcc
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64fe9bcc
编写于
10月 23, 2017
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update lstm comments and fix bug.
上级
34aac18c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
16 addition
and
15 deletion
+16
-15
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+2
-1
paddle/operators/CMakeLists.txt
paddle/operators/CMakeLists.txt
+1
-1
paddle/operators/lstm_op.cc
paddle/operators/lstm_op.cc
+9
-9
paddle/operators/lstm_op.h
paddle/operators/lstm_op.h
+2
-4
paddle/operators/math/sequence2batch.cc
paddle/operators/math/sequence2batch.cc
+2
-0
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
64fe9bcc
...
...
@@ -20,7 +20,8 @@ proto_library(framework_proto SRCS framework.proto)
cc_library
(
attribute SRCS attribute.cc DEPS framework_proto
)
cc_library
(
proto_desc SRCS var_desc.cc op_desc.cc block_desc.cc program_desc.cc DEPS attribute ddim op_info
)
cc_test
(
program_desc_test SRCS program_desc_test.cc DEPS proto_desc
)
cc_test
(
program_desc_test SRCS program_desc_test.cc DEPS proto_desc
device_context
)
cc_library
(
op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute
)
cc_test
(
op_proto_maker_test SRCS op_proto_maker_test.cc DEPS op_proto_maker
)
cc_library
(
op_info SRCS op_info.cc DEPS attribute framework_proto
)
...
...
paddle/operators/CMakeLists.txt
浏览文件 @
64fe9bcc
...
...
@@ -127,7 +127,7 @@ op_library(softmax_with_cross_entropy_op DEPS cross_entropy softmax)
op_library
(
sum_op DEPS net_op
)
op_library
(
pool_op DEPS pooling
)
op_library
(
pool_with_index_op DEPS pooling
)
op_library
(
lstm_op DEPS sequence2batch lstm_compute
math_function
)
op_library
(
lstm_op DEPS sequence2batch lstm_compute
)
list
(
REMOVE_ITEM GENERAL_OPS
${
DEPS_OPS
}
)
foreach
(
src
${
GENERAL_OPS
}
)
...
...
paddle/operators/lstm_op.cc
浏览文件 @
64fe9bcc
...
...
@@ -98,18 +98,18 @@ class LSTMOpMaker : public framework::OpProtoAndCheckerMaker {
"batch size. `H0` and `C0` can be NULL but only at the same time"
);
AddInput
(
"Weight"
,
"(Tensor) the learnable hidden-hidden weights."
" - The shape is (D x 4
*
D), where D is the hidden size. "
" - Weight = {W_
ih, W_fh, W_c
h, W_oh}"
);
" - The shape is (D x 4D), where D is the hidden size. "
" - Weight = {W_
ch, W_ih, W_f
h, W_oh}"
);
AddInput
(
"Bias"
,
"(Tensor) the learnable weights, which contains two parts: "
"input-hidden bias weight and peephole connections weight if "
"seting `usePeepholes` True. "
"set
t
ing `usePeepholes` True. "
"1. `usePeepholes = False` "
" - The shape is (1 x 4
*
D). "
" - Bias = {b_
i, b_f, b_c
, b_o}."
" - The shape is (1 x 4D). "
" - Bias = {b_
c, b_i, b_f
, b_o}."
"2. `usePeepholes = True` "
" - The shape is (1 x 7
*
D). "
" - Bias = {b_
i, b_f, b_c
, b_o, W_ic, W_fc, W_oc}."
);
" - The shape is (1 x 7D). "
" - Bias = {b_
c, b_i, b_f
, b_o, W_ic, W_fc, W_oc}."
);
AddOutput
(
"BatchGate"
,
"(LoDTensor) This LoDTensor contains input gate, forget gate "
"and output gate after the nonlinear computation. This "
...
...
@@ -184,8 +184,8 @@ Set `usePeepholes` False to disable peephole connection [2]. The formula
is omitted here.
@note These \f$W_{xi}x_{t}, W_{xf}x_{t}, W_{xc}x_{t}, W_{xo}x_{t}\f$
operations on the input x_{t} were NOT included in this operator.
The
u
sers can choose to use fully-connect operator before LSTM operator.
operations on the input x_{t} were NOT included in this operator.
U
sers can choose to use fully-connect operator before LSTM operator.
[1] Hasim Sak, Andrew Senior, and Francoise Beaufays. Long short-term memory
recurrent neural network architectures for large scale acoustic modeling.
...
...
paddle/operators/lstm_op.h
浏览文件 @
64fe9bcc
...
...
@@ -76,14 +76,12 @@ class LSTMKernel : public framework::OpKernel<T> {
lstm_value
.
checkOg
=
lstm_value
.
checkFg
+
frame_size
;
lstm_value
.
prevStateValue
=
nullptr
;
framework
::
LoDTensor
batch_out
;
framework
::
LoDTensor
batch_out
,
batch_cell
,
batch_cell_pre_act
;
batch_out
.
mutable_data
<
T
>
(
dims
,
ctx
.
GetPlace
());
framework
::
LoDTensor
batch_cell
;
batch_cell
.
mutable_data
<
T
>
(
dims
,
ctx
.
GetPlace
());
framework
::
LoDTensor
batch_cell_pre_act
;
batch_cell_pre_act
.
mutable_data
<
T
>
(
dims
,
ctx
.
GetPlace
());
auto
&
batch_starts
=
batch_gate
->
lod
()[
0
];
auto
batch_starts
=
batch_gate
->
lod
()[
0
];
size_t
num_batch
=
batch_starts
.
size
()
-
1
;
auto
gate_act
=
ctx
.
Attr
<
std
::
string
>
(
"gateActivation"
);
auto
cell_act
=
ctx
.
Attr
<
std
::
string
>
(
"cellActivation"
);
...
...
paddle/operators/math/sequence2batch.cc
浏览文件 @
64fe9bcc
...
...
@@ -51,6 +51,8 @@ class CopyMatrixRowsFunctor<platform::CPUPlace, T> {
template
class
CopyMatrixRowsFunctor
<
platform
::
CPUPlace
,
float
>;
template
class
CopyMatrixRowsFunctor
<
platform
::
CPUPlace
,
double
>;
template
class
LoDTensor2BatchFunctor
<
platform
::
CPUPlace
,
float
>;
template
class
LoDTensor2BatchFunctor
<
platform
::
CPUPlace
,
double
>;
template
class
Batch2LoDTensorFunctor
<
platform
::
CPUPlace
,
float
>;
template
class
Batch2LoDTensorFunctor
<
platform
::
CPUPlace
,
double
>;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录