Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
c5b556f0
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c5b556f0
编写于
11月 02, 2017
作者:
D
daming-lu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into fix_deploy_script
上级
16132c24
4b9a2c44
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
13 addition
and
12 deletion
+13
-12
paddle/operators/lookup_table_op.h
paddle/operators/lookup_table_op.h
+3
-1
paddle/operators/sequence_pool_op.cc
paddle/operators/sequence_pool_op.cc
+2
-1
python/paddle/v2/framework/layers.py
python/paddle/v2/framework/layers.py
+2
-6
python/paddle/v2/framework/nets.py
python/paddle/v2/framework/nets.py
+2
-1
python/paddle/v2/framework/tests/test_evaluator.py
python/paddle/v2/framework/tests/test_evaluator.py
+1
-0
python/paddle/v2/framework/tests/test_recommender_system.py
python/paddle/v2/framework/tests/test_recommender_system.py
+3
-3
未找到文件。
paddle/operators/lookup_table_op.h
浏览文件 @
c5b556f0
...
...
@@ -90,11 +90,13 @@ class LookupTableGradKernel : public framework::OpKernel<T> {
auto
*
d_output_data
=
d_output
->
data
<
T
>
();
auto
*
d_table_data
=
d_table
->
mutable_data
<
T
>
(
context
.
GetPlace
());
memset
(
d_table_data
,
0
,
d_table
->
numel
()
*
sizeof
(
T
));
for
(
int64_t
i
=
0
;
i
<
ids
->
numel
();
++
i
)
{
PADDLE_ENFORCE_LT
(
ids_data
[
i
],
N
);
PADDLE_ENFORCE_GE
(
ids_data
[
i
],
0
);
for
(
int
j
=
0
;
j
<
D
;
++
j
)
{
d_table_data
[
ids_data
[
i
]
*
D
+
j
]
=
d_output_data
[
i
*
D
+
j
];
d_table_data
[
ids_data
[
i
]
*
D
+
j
]
+
=
d_output_data
[
i
*
D
+
j
];
}
}
}
...
...
paddle/operators/sequence_pool_op.cc
浏览文件 @
c5b556f0
...
...
@@ -42,7 +42,8 @@ class SequencePoolOpMaker : public framework::OpProtoAndCheckerMaker {
AddAttr
<
std
::
string
>
(
"pooltype"
,
"(int, default AVERAGE) the pooling pooltype of SequencePoolOp."
)
.
SetDefault
(
"AVERAGE"
);
.
SetDefault
(
"AVERAGE"
)
.
InEnum
({
"AVERAGE"
,
"SUM"
,
"SQRT"
,
"LAST"
,
"FIRST"
,
"MAX"
});
AddComment
(
R"DOC(
SequencePoolOp pools features of all time-steps of each instance.
...
...
python/paddle/v2/framework/layers.py
浏览文件 @
c5b556f0
...
...
@@ -278,6 +278,7 @@ def sequence_conv(input,
num_filters
,
filter_size
=
3
,
filter_stride
=
1
,
act
=
None
,
padding
=
None
,
bias_attr
=
None
,
param_attr
=
None
,
...
...
@@ -304,7 +305,7 @@ def sequence_conv(input,
outputs
=
{
"Out"
:
pre_bias
},
attrs
=
{
'contextStride'
:
filter_stride
,
'contextStart'
:
0
,
'contextStart'
:
-
int
(
filter_size
/
2
)
,
'contextLength'
:
filter_size
})
pre_act
=
helper
.
append_bias_op
(
pre_bias
)
...
...
@@ -364,11 +365,6 @@ def conv2d(input,
def
sequence_pool
(
input
,
pool_type
,
**
kwargs
):
ENUM_POOL_TYPE
=
set
([
"MAX"
,
"AVG"
,
"SQRT"
,
"LAST"
,
"FIRST"
])
if
pool_type
.
upper
()
not
in
ENUM_POOL_TYPE
:
raise
ValueError
(
"Unknown pool_type: '%s'. It can only be %s."
,
str
(
pool_type
),
" "
.
join
(
ENUM_POOL_TYPE
))
helper
=
LayerHelper
(
'sequence_pool'
,
input
=
input
,
**
kwargs
)
dtype
=
helper
.
input_dtype
()
pool_out
=
helper
.
create_tmp_variable
(
dtype
)
...
...
python/paddle/v2/framework/nets.py
浏览文件 @
c5b556f0
...
...
@@ -47,7 +47,7 @@ def img_conv_group(input,
"""
tmp
=
input
assert
isinstance
(
conv_num_filter
,
list
)
or
\
isinstance
(
conv_num_filter
,
tuple
)
isinstance
(
conv_num_filter
,
tuple
)
def
__extend_list__
(
obj
):
if
not
hasattr
(
obj
,
'__len__'
):
...
...
@@ -109,6 +109,7 @@ def sequence_conv_pool(input,
input
=
input
,
num_filters
=
num_filters
,
filter_size
=
filter_size
,
act
=
act
,
program
=
program
,
init_program
=
init_program
)
...
...
python/paddle/v2/framework/tests/test_evaluator.py
浏览文件 @
c5b556f0
...
...
@@ -60,4 +60,5 @@ class TestEvaluator(unittest.TestCase):
if
__name__
==
'__main__'
:
exit
(
0
)
unittest
.
main
()
python/paddle/v2/framework/tests/test_recommender_system.py
浏览文件 @
c5b556f0
...
...
@@ -243,7 +243,7 @@ def model():
def
main
():
cost
=
model
()
sgd_optimizer
=
optimizer
.
SGDOptimizer
(
learning_rate
=
0.2
)
opts
=
sgd_optimizer
.
minimize
(
cost
)
opts
=
sgd_optimizer
.
minimize
(
cost
,
init_program
=
init_program
)
block
=
program
.
block
(
0
)
if
use_gpu
:
...
...
@@ -305,8 +305,8 @@ def main():
feed
=
func_feed
(
feeding
,
data
),
fetch_list
=
[
cost
])
out
=
np
.
array
(
outs
[
0
])
if
out
[
0
]
<
5
.0
:
# if avg cost less than
10
.0, we think our code is good.
if
out
[
0
]
<
6
.0
:
# if avg cost less than
6
.0, we think our code is good.
exit
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录