Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
溜达小灰鼠
Paddle
提交
fc47492f
P
Paddle
项目概览
溜达小灰鼠
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc47492f
编写于
1月 05, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix merge conflict bug and glog
上级
b090ce32
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
35 deletion
+38
-35
paddle/function/CMakeLists.txt
paddle/function/CMakeLists.txt
+0
-2
paddle/function/ContextProjectionOp.cpp
paddle/function/ContextProjectionOp.cpp
+26
-26
paddle/function/Function.cpp
paddle/function/Function.cpp
+8
-4
paddle/gserver/layers/ContextProjection.cpp
paddle/gserver/layers/ContextProjection.cpp
+4
-2
warp-ctc
warp-ctc
+0
-1
未找到文件。
paddle/function/CMakeLists.txt
浏览文件 @
fc47492f
...
...
@@ -12,8 +12,6 @@ endif()
add_library
(
paddle_function STATIC
${
cpp_files
}
${
cu_objs
}
)
add_dependencies
(
paddle_function
${
external_project_dependencies
}
)
add_library
(
paddle_test_main STATIC TestMain.cpp
)
add_dependencies
(
paddle_test_main
${
external_project_dependencies
}
)
if
(
WITH_GPU
)
if
(
WITH_TESTING
)
...
...
paddle/function/ContextProjectionOp.cpp
浏览文件 @
fc47492f
...
...
@@ -85,15 +85,15 @@ public:
void
calc
(
const
Arguments
&
inputs
,
const
Arguments
&
outputs
,
const
Arguments
&
inouts
)
override
{
CHECK_EQ
(
3
,
inputs
.
size
(
));
CHECK_EQ
(
1
,
outputs
.
size
(
));
CHECK_EQ
(
0
,
inouts
.
size
(
));
CHECK_EQ
(
3
,
static_cast
<
int
>
(
inputs
.
size
()
));
CHECK_EQ
(
1
,
static_cast
<
int
>
(
outputs
.
size
()
));
CHECK_EQ
(
0
,
static_cast
<
int
>
(
inouts
.
size
()
));
CHECK
(
outputs
[
0
].
getData
()
&&
inputs
[
0
].
getData
()
&&
inputs
[
2
].
getData
());
CHECK_EQ
(
outputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
1
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
2
].
dims_
.
size
(
),
1
);
CHECK_EQ
(
static_cast
<
int
>
(
outputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
1
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
2
].
dims_
.
size
()
),
1
);
/// dim of output = dim of input * context_length
CHECK_EQ
(
outputs
[
0
].
dims_
[
1
],
inputs
[
0
].
dims_
[
1
]
*
context_length_
);
/// dim of input == dim of weight
...
...
@@ -202,15 +202,15 @@ public:
void
calc
(
const
Arguments
&
inputs
,
const
Arguments
&
outputs
,
const
Arguments
&
inouts
)
override
{
CHECK_EQ
(
3
,
inputs
.
size
(
));
CHECK_EQ
(
1
,
outputs
.
size
(
));
CHECK_EQ
(
0
,
inouts
.
size
(
));
CHECK_EQ
(
3
,
static_cast
<
int
>
(
inputs
.
size
()
));
CHECK_EQ
(
1
,
static_cast
<
int
>
(
outputs
.
size
()
));
CHECK_EQ
(
0
,
static_cast
<
int
>
(
inouts
.
size
()
));
CHECK
(
outputs
[
0
].
getData
()
&&
inputs
[
2
].
getData
());
CHECK_EQ
(
outputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
1
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
2
].
dims_
.
size
(
),
1
);
CHECK_EQ
(
static_cast
<
int
>
(
outputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
1
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
2
].
dims_
.
size
()
),
1
);
/// dim of input == dim of weight
CHECK_EQ
(
inputs
[
0
].
dims_
[
1
],
inputs
[
1
].
dims_
[
1
]);
...
...
@@ -269,13 +269,13 @@ public:
void
calc
(
const
Arguments
&
inputs
,
const
Arguments
&
outputs
,
const
Arguments
&
inouts
)
override
{
CHECK_EQ
(
2
,
inputs
.
size
(
));
CHECK_EQ
(
1
,
outputs
.
size
(
));
CHECK_EQ
(
0
,
inouts
.
size
(
));
CHECK_EQ
(
2
,
static_cast
<
int
>
(
inputs
.
size
()
));
CHECK_EQ
(
1
,
static_cast
<
int
>
(
outputs
.
size
()
));
CHECK_EQ
(
0
,
static_cast
<
int
>
(
inouts
.
size
()
));
CHECK
(
inputs
[
0
].
getData
()
&&
outputs
[
0
].
getData
()
&&
inputs
[
1
].
getData
());
CHECK_EQ
(
outputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
1
].
dims_
.
size
(
),
1
);
CHECK_EQ
(
static_cast
<
int
>
(
outputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
1
].
dims_
.
size
()
),
1
);
CHECK_EQ
(
outputs
[
0
].
dims_
[
1
],
inputs
[
0
].
dims_
[
1
]
*
context_length_
);
/// input and output has the same batch_size
CHECK_EQ
(
inputs
[
0
].
dims_
[
0
],
outputs
[
0
].
dims_
[
0
]);
...
...
@@ -317,14 +317,14 @@ public:
void
calc
(
const
Arguments
&
inputs
,
const
Arguments
&
outputs
,
const
Arguments
&
inouts
)
override
{
CHECK_EQ
(
2
,
inputs
.
size
(
));
CHECK_EQ
(
1
,
outputs
.
size
(
));
CHECK_EQ
(
0
,
inouts
.
size
(
));
CHECK_EQ
(
2
,
static_cast
<
int
>
(
inputs
.
size
()
));
CHECK_EQ
(
1
,
static_cast
<
int
>
(
outputs
.
size
()
));
CHECK_EQ
(
0
,
static_cast
<
int
>
(
inouts
.
size
()
));
CHECK
(
inputs
[
0
].
getData
()
&&
outputs
[
0
].
getData
()
&&
inputs
[
1
].
getData
());
CHECK_EQ
(
outputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
0
].
dims_
.
size
(
),
2
);
CHECK_EQ
(
inputs
[
1
].
dims_
.
size
(
),
1
);
CHECK_EQ
(
static_cast
<
int
>
(
outputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
0
].
dims_
.
size
()
),
2
);
CHECK_EQ
(
static_cast
<
int
>
(
inputs
[
1
].
dims_
.
size
()
),
1
);
CHECK_EQ
(
outputs
[
0
].
dims_
[
1
],
inputs
[
0
].
dims_
[
1
]
*
context_length_
);
auto
out_grad_mat
=
std
::
make_shared
<
typename
MatrixT
<
Device
>::
type
>
(
...
...
paddle/function/Function.cpp
浏览文件 @
fc47492f
...
...
@@ -46,28 +46,32 @@ bool FuncConfig::get<bool>(const std::string& key) const {
template
<
>
FuncConfig
&
FuncConfig
::
set
<
size_t
>
(
const
std
::
string
&
key
,
size_t
v
)
{
CHECK_EQ
(
valueMap_
.
count
(
key
),
0
)
<<
"Duplicated value: "
<<
key
;
CHECK_EQ
(
static_cast
<
int
>
(
valueMap_
.
count
(
key
)),
0
)
<<
"Duplicated value: "
<<
key
;
valueMap_
[
key
].
s
=
v
;
return
*
this
;
}
template
<
>
FuncConfig
&
FuncConfig
::
set
<
real
>
(
const
std
::
string
&
key
,
real
v
)
{
CHECK_EQ
(
valueMap_
.
count
(
key
),
0
)
<<
"Duplicated value: "
<<
key
;
CHECK_EQ
(
static_cast
<
int
>
(
valueMap_
.
count
(
key
)),
0
)
<<
"Duplicated value: "
<<
key
;
valueMap_
[
key
].
r
=
v
;
return
*
this
;
}
template
<
>
FuncConfig
&
FuncConfig
::
set
<
int
>
(
const
std
::
string
&
key
,
int
v
)
{
CHECK_EQ
(
valueMap_
.
count
(
key
),
0
)
<<
"Duplicated value: "
<<
key
;
CHECK_EQ
(
static_cast
<
int
>
(
valueMap_
.
count
(
key
)),
0
)
<<
"Duplicated value: "
<<
key
;
valueMap_
[
key
].
i
=
v
;
return
*
this
;
}
template
<
>
FuncConfig
&
FuncConfig
::
set
<
bool
>
(
const
std
::
string
&
key
,
bool
v
)
{
CHECK_EQ
(
valueMap_
.
count
(
key
),
0
)
<<
"Duplicated value: "
<<
key
;
CHECK_EQ
(
static_cast
<
int
>
(
valueMap_
.
count
(
key
)),
0
)
<<
"Duplicated value: "
<<
key
;
valueMap_
[
key
].
b
=
v
;
return
*
this
;
}
...
...
paddle/gserver/layers/ContextProjection.cpp
浏览文件 @
fc47492f
...
...
@@ -111,7 +111,8 @@ void ContextProjection::forward() {
size_t
dim
=
out_
->
value
->
getWidth
();
CHECK_EQ
(
dim
,
input_dim
*
config_
.
context_length
());
size_t
batch_size
=
in_
->
value
->
getHeight
();
CHECK_EQ
(
forward_
.
size
(),
1
)
<<
"Only one forward function here"
;
CHECK_EQ
(
static_cast
<
int
>
(
forward_
.
size
()),
1
)
<<
"Only one forward function here"
;
REGISTER_TIMER_INFO
(
"ContextProjectionForward"
,
getName
().
c_str
());
bool
is_padding
=
config_
.
trainable_padding
();
...
...
@@ -154,7 +155,8 @@ void ContextProjection::backward(const UpdateCallback& callback) {
CHECK_EQ
(
dim
,
input_dim
*
config_
.
context_length
());
size_t
batch_size
=
in_
->
value
->
getHeight
();
CHECK_EQ
(
batch_size
,
out_
->
value
->
getHeight
());
CHECK_EQ
(
backward_
.
size
(),
1
)
<<
"Only one backward function here"
;
CHECK_EQ
(
static_cast
<
int
>
(
backward_
.
size
()),
1
)
<<
"Only one backward function here"
;
REGISTER_TIMER_INFO
(
"ContextProjectionBackward"
,
getName
().
c_str
());
bool
is_padding
=
config_
.
trainable_padding
();
...
...
warp-ctc
@
bd535c8d
Subproject commit bd535c8d44e03c8ebd2d768e06c8c05fdccd11d2
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录