Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
恒星小白
Paddle
提交
7b8f9fdd
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,发现更多精彩内容 >>
提交
7b8f9fdd
编写于
8月 25, 2017
作者:
Z
zchen0211
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/Paddle
into develop
上级
97649bf9
6e8eccb1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
27 addition
and
14 deletion
+27
-14
.pre-commit-config.yaml
.pre-commit-config.yaml
+1
-1
paddle/capi/CMakeLists.txt
paddle/capi/CMakeLists.txt
+3
-0
paddle/capi/export.map
paddle/capi/export.map
+6
-0
paddle/capi/export.sym
paddle/capi/export.sym
+0
-0
paddle/gserver/layers/SequenceSliceLayer.cpp
paddle/gserver/layers/SequenceSliceLayer.cpp
+10
-8
paddle/gserver/tests/test_SeqSliceLayerGrad.cpp
paddle/gserver/tests/test_SeqSliceLayerGrad.cpp
+3
-1
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+4
-4
未找到文件。
.pre-commit-config.yaml
浏览文件 @
7b8f9fdd
...
...
@@ -22,7 +22,7 @@
-
id
:
clang-format-with-version-check
name
:
clang-format
description
:
Format files with ClangFormat.
entry
:
./.clang_format.hook -i
entry
:
bash
./.clang_format.hook -i
language
:
system
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$
-
repo
:
https://github.com/PaddlePaddle/pre-commit-golang
...
...
paddle/capi/CMakeLists.txt
浏览文件 @
7b8f9fdd
...
...
@@ -53,7 +53,10 @@ add_custom_target(paddle_capi_whole ALL
set_target_properties
(
paddle_capi_whole
PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
)
set
(
LINK_FLAGS
" -Wl,--retain-symbols-file
${
CMAKE_CURRENT_SOURCE_DIR
}
/export.sym -Wl,--version-script
${
CMAKE_CURRENT_SOURCE_DIR
}
/export.map"
)
# TODO: merge mkl into paddle_capi_shared
add_library
(
paddle_capi_shared SHARED
${
CAPI_SOURCES
}
)
set_target_properties
(
paddle_capi_shared PROPERTIES LINK_FLAGS
"
${
LINK_FLAGS
}
"
)
target_include_directories
(
paddle_capi_shared PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
)
link_paddle_exe
(
paddle_capi_shared
)
...
...
paddle/capi/export.map
0 → 100644
浏览文件 @
7b8f9fdd
{
global:
paddle_*;
local:
*;
};
paddle/capi/export.sym
0 → 100644
浏览文件 @
7b8f9fdd
paddle/gserver/layers/SequenceSliceLayer.cpp
浏览文件 @
7b8f9fdd
...
...
@@ -130,6 +130,8 @@ void SequenceSliceLayer::calSelectedRows(const MatrixPtr starts,
CHECK
(
starts
||
ends
)
<<
"At least one of the start or end indices "
<<
"should be given."
;
bool
hasSubseq
=
getInput
(
0
).
hasSubseq
();
outSeqStartPos_
.
resize
(
1
,
0
);
outSubSeqStartPos_
.
resize
(
1
,
0
);
selectedRows_
.
clear
();
...
...
@@ -151,14 +153,13 @@ void SequenceSliceLayer::calSelectedRows(const MatrixPtr starts,
int
seqLen
=
endPos
-
begPos
+
1
;
CHECK_GT
(
seqLen
,
0U
);
for
(
int
m
=
begPos
;
m
<=
endPos
;
++
m
)
selectedRows_
.
push_back
(
m
);
inputSeqInfoVec_
.
size
()
>
1
hasSubseq
?
outSubSeqStartPos_
.
push_back
(
outSubSeqStartPos_
.
back
()
+
seqLen
)
:
outSeqStartPos_
.
push_back
(
outSeqStartPos_
.
back
()
+
seqLen
);
}
rowIdx
++
;
}
if
(
inputSeqInfoVec_
.
size
()
>
1
)
outSeqStartPos_
.
push_back
(
outSubSeqStartPos_
.
back
());
if
(
hasSubseq
)
outSeqStartPos_
.
push_back
(
outSubSeqStartPos_
.
back
());
}
if
(
useGpu_
)
{
...
...
@@ -175,7 +176,7 @@ void SequenceSliceLayer::calSelectedRows(const MatrixPtr starts,
output_
.
sequenceStartPositions
->
copyFrom
(
outSeqStartPos_
.
data
(),
outSeqStartPos_
.
size
(),
false
);
if
(
inputSeqInfoVec_
.
size
()
>
1
)
{
if
(
hasSubseq
)
{
ICpuGpuVector
::
resizeOrCreate
(
output_
.
subSequenceStartPositions
,
outSubSeqStartPos_
.
size
(),
false
);
output_
.
subSequenceStartPositions
->
copyFrom
(
...
...
@@ -204,10 +205,11 @@ void SequenceSliceLayer::forward(PassType passType) {
copySliceIdsToCpu
();
}
// calculate the selected row indices in a batch,
// and build the output sequence information.
calSelectedRows
(
startIdsOnCpu_
?
startIdsOnCpu_
:
nullptr
,
endIdsOnCpu_
?
endIdsOnCpu_
:
nullptr
);
/*
* calculate the selected row indices in a batch, and build the output
* sequence information.
*/
calSelectedRows
(
startIdsOnCpu_
,
endIdsOnCpu_
);
resetOutput
(
selectedRows_
.
size
(),
getSize
());
...
...
paddle/gserver/tests/test_SeqSliceLayerGrad.cpp
浏览文件 @
7b8f9fdd
...
...
@@ -30,6 +30,8 @@ const int MAX_SEQ_NUM = 17;
const
int
MAX_SEQ_LEN
=
23
;
const
int
MAX_BEAM_SIZE
=
13
;
const
size_t
SEED
=
(
size_t
)(
time
(
NULL
));
vector
<
real
>
randSampling
(
real
range
,
int
n
)
{
CHECK_GE
(
range
,
n
);
vector
<
real
>
num
(
range
);
...
...
@@ -46,7 +48,7 @@ void genSeqInfo(vector<int>& seqStartPos, vector<int>& subSeqStartPos) {
seqStartPos
.
resize
(
1
,
0
);
subSeqStartPos
.
resize
(
1
,
0
);
srand
(
(
size_t
)(
time
(
NULL
))
);
srand
(
SEED
);
int
seqNum
=
1
+
(
rand
()
%
MAX_SEQ_NUM
);
for
(
int
i
=
0
;
i
<
seqNum
;
++
i
)
{
int
subSeqNum
=
1
+
(
rand
()
%
MAX_SEQ_NUM
);
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
7b8f9fdd
...
...
@@ -2607,15 +2607,15 @@ def img_pool_layer(input,
assert
input
.
num_filters
is
not
None
num_channels
=
input
.
num_filters
assert
type
(
pool_type
)
in
[
AvgPooling
,
MaxPooling
,
CudnnAvgPooling
,
CudnnMaxPooling
],
\
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling are supported"
if
pool_type
is
None
:
pool_type
=
MaxPooling
()
elif
isinstance
(
pool_type
,
AvgPooling
):
pool_type
.
name
=
'avg'
assert
type
(
pool_type
)
in
[
AvgPooling
,
MaxPooling
,
CudnnAvgPooling
,
CudnnMaxPooling
],
\
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling are supported"
type_name
=
pool_type
.
name
+
'-projection'
\
if
(
isinstance
(
pool_type
,
AvgPooling
)
or
isinstance
(
pool_type
,
MaxPooling
))
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录