Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
b368c6ca
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,发现更多精彩内容 >>
提交
b368c6ca
编写于
8月 09, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename op_proto_name/var_names -> parameter/arguments
上级
3d4ba22c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
39 deletion
+39
-39
paddle/framework/framework.proto
paddle/framework/framework.proto
+2
-2
paddle/framework/op_registry.h
paddle/framework/op_registry.h
+4
-4
paddle/framework/op_registry_test.cc
paddle/framework/op_registry_test.cc
+16
-16
paddle/framework/operator_test.cc
paddle/framework/operator_test.cc
+17
-17
未找到文件。
paddle/framework/framework.proto
浏览文件 @
b368c6ca
...
...
@@ -40,8 +40,8 @@ message OpDesc {
};
message
Var
{
required
string
op_proto_name
=
1
;
repeated
string
var_name
s
=
2
;
required
string
parameter
=
1
;
repeated
string
argument
s
=
2
;
};
required
string
type
=
3
;
...
...
paddle/framework/op_registry.h
浏览文件 @
b368c6ca
...
...
@@ -180,8 +180,8 @@ class OpRegistry {
static
std
::
shared_ptr
<
OperatorBase
>
CreateOp
(
const
OpDesc
&
op_desc
)
{
VarNameMap
inputs
;
for
(
auto
&
input
:
op_desc
.
inputs
())
{
auto
&
var_names
=
inputs
[
input
.
op_proto_name
()];
auto
&
var_names_in_proto
=
input
.
var_name
s
();
auto
&
var_names
=
inputs
[
input
.
parameter
()];
auto
&
var_names_in_proto
=
input
.
argument
s
();
var_names
.
reserve
(
static_cast
<
size_t
>
(
var_names_in_proto
.
size
()));
std
::
copy
(
var_names_in_proto
.
begin
(),
var_names_in_proto
.
end
(),
std
::
back_inserter
(
var_names
));
...
...
@@ -189,8 +189,8 @@ class OpRegistry {
VarNameMap
outputs
;
for
(
auto
&
output
:
op_desc
.
outputs
())
{
auto
&
var_names
=
outputs
[
output
.
op_proto_name
()];
auto
&
var_names_in_proto
=
output
.
var_name
s
();
auto
&
var_names
=
outputs
[
output
.
parameter
()];
auto
&
var_names_in_proto
=
output
.
argument
s
();
var_names
.
reserve
(
static_cast
<
size_t
>
(
var_names_in_proto
.
size
()));
std
::
copy
(
var_names_in_proto
.
begin
(),
var_names_in_proto
.
end
(),
std
::
back_inserter
(
var_names
));
...
...
paddle/framework/op_registry_test.cc
浏览文件 @
b368c6ca
...
...
@@ -58,12 +58,12 @@ TEST(OpRegistry, CreateOp) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"cos_sim"
);
auto
input
=
op_desc
.
add_inputs
();
input
->
set_
op_proto_name
(
"input"
);
*
input
->
mutable_
var_name
s
()
->
Add
()
=
"aa"
;
input
->
set_
parameter
(
"input"
);
*
input
->
mutable_
argument
s
()
->
Add
()
=
"aa"
;
auto
output
=
op_desc
.
add_outputs
();
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"bb"
;
output
->
set_
parameter
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"bb"
;
float
scale
=
3.3
;
auto
attr
=
op_desc
.
mutable_attrs
()
->
Add
();
...
...
@@ -84,12 +84,12 @@ TEST(OpRegistry, IllegalAttr) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"cos_sim"
);
auto
input
=
op_desc
.
add_inputs
();
input
->
set_
op_proto_name
(
"input"
);
*
input
->
mutable_
var_name
s
()
->
Add
()
=
"aa"
;
input
->
set_
parameter
(
"input"
);
*
input
->
mutable_
argument
s
()
->
Add
()
=
"aa"
;
auto
output
=
op_desc
.
add_outputs
();
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"bb"
;
output
->
set_
parameter
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"bb"
;
auto
attr
=
op_desc
.
mutable_attrs
()
->
Add
();
attr
->
set_name
(
"scale"
);
...
...
@@ -114,12 +114,12 @@ TEST(OpRegistry, DefaultValue) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"cos_sim"
);
auto
input
=
op_desc
.
add_inputs
();
input
->
set_
op_proto_name
(
"input"
);
*
input
->
mutable_
var_name
s
()
->
Add
()
=
"aa"
;
input
->
set_
parameter
(
"input"
);
*
input
->
mutable_
argument
s
()
->
Add
()
=
"aa"
;
auto
output
=
op_desc
.
add_outputs
();
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"bb"
;
output
->
set_
parameter
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"bb"
;
ASSERT_TRUE
(
op_desc
.
IsInitialized
());
...
...
@@ -143,12 +143,12 @@ TEST(OpRegistry, CustomChecker) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"my_test_op"
);
auto
input
=
op_desc
.
add_inputs
();
input
->
set_
op_proto_name
(
"input"
);
*
input
->
mutable_
var_name
s
()
->
Add
()
=
"ii"
;
input
->
set_
parameter
(
"input"
);
*
input
->
mutable_
argument
s
()
->
Add
()
=
"ii"
;
auto
output
=
op_desc
.
add_outputs
();
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"oo"
;
output
->
set_
parameter
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"oo"
;
SetInputFormat
(
&
op_desc
);
// attr 'test_attr' is not set
...
...
paddle/framework/operator_test.cc
浏览文件 @
b368c6ca
...
...
@@ -61,12 +61,12 @@ TEST(OperatorBase, all) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"test_operator"
);
auto
*
ipt
=
op_desc
.
mutable_inputs
()
->
Add
();
*
ipt
->
mutable_
var_name
s
()
->
Add
()
=
"IN1"
;
ipt
->
set_
op_proto_name
(
"input"
);
*
ipt
->
mutable_
argument
s
()
->
Add
()
=
"IN1"
;
ipt
->
set_
parameter
(
"input"
);
auto
*
output
=
op_desc
.
mutable_outputs
()
->
Add
();
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"OUT1"
;
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"OUT1"
;
output
->
set_
parameter
(
"output"
);
auto
attr
=
op_desc
.
mutable_attrs
()
->
Add
();
attr
->
set_name
(
"scale"
);
attr
->
set_type
(
paddle
::
framework
::
AttrType
::
FLOAT
);
...
...
@@ -184,12 +184,12 @@ TEST(OpKernel, all) {
paddle
::
framework
::
OpDesc
op_desc
;
op_desc
.
set_type
(
"op_with_kernel"
);
auto
*
ipt
=
op_desc
.
mutable_inputs
()
->
Add
();
*
ipt
->
mutable_
var_name
s
()
->
Add
()
=
"IN1"
;
ipt
->
set_
op_proto_name
(
"input"
);
*
ipt
->
mutable_
argument
s
()
->
Add
()
=
"IN1"
;
ipt
->
set_
parameter
(
"input"
);
auto
*
output
=
op_desc
.
mutable_outputs
()
->
Add
();
*
output
->
mutable_
var_name
s
()
->
Add
()
=
"OUT1"
;
output
->
set_
op_proto_name
(
"output"
);
*
output
->
mutable_
argument
s
()
->
Add
()
=
"OUT1"
;
output
->
set_
parameter
(
"output"
);
auto
attr
=
op_desc
.
mutable_attrs
()
->
Add
();
attr
->
set_name
(
"scale"
);
...
...
@@ -217,17 +217,17 @@ TEST(OpKernel, multi_inputs) {
OpDesc
op_desc
;
op_desc
.
set_type
(
"op_multi_inputs_with_kernel"
);
auto
x
=
op_desc
.
mutable_inputs
()
->
Add
();
x
->
set_
op_proto_name
(
"xs"
);
*
x
->
mutable_
var_name
s
()
->
Add
()
=
"x0"
;
*
x
->
mutable_
var_name
s
()
->
Add
()
=
"x1"
;
*
x
->
mutable_
var_name
s
()
->
Add
()
=
"x2"
;
x
->
set_
parameter
(
"xs"
);
*
x
->
mutable_
argument
s
()
->
Add
()
=
"x0"
;
*
x
->
mutable_
argument
s
()
->
Add
()
=
"x1"
;
*
x
->
mutable_
argument
s
()
->
Add
()
=
"x2"
;
auto
k
=
op_desc
.
mutable_inputs
()
->
Add
();
k
->
set_
op_proto_name
(
"k"
);
*
k
->
mutable_
var_name
s
()
->
Add
()
=
"k0"
;
k
->
set_
parameter
(
"k"
);
*
k
->
mutable_
argument
s
()
->
Add
()
=
"k0"
;
auto
y
=
op_desc
.
mutable_outputs
()
->
Add
();
y
->
set_
op_proto_name
(
"ys"
);
*
y
->
mutable_
var_name
s
()
->
Add
()
=
"y0"
;
*
y
->
mutable_
var_name
s
()
->
Add
()
=
"y1"
;
y
->
set_
parameter
(
"ys"
);
*
y
->
mutable_
argument
s
()
->
Add
()
=
"y0"
;
*
y
->
mutable_
argument
s
()
->
Add
()
=
"y1"
;
auto
attr
=
op_desc
.
mutable_attrs
()
->
Add
();
attr
->
set_name
(
"scale"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录