Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
020e45f7
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
020e45f7
编写于
9月 05, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments to revert add_two_op to add_op
上级
3ab93275
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
16 addition
and
18 deletion
+16
-18
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-1
paddle/framework/grad_op_builder_test.cc
paddle/framework/grad_op_builder_test.cc
+2
-2
paddle/operators/add_op.cc
paddle/operators/add_op.cc
+3
-4
paddle/operators/add_op.cu
paddle/operators/add_op.cu
+2
-3
paddle/operators/add_op.h
paddle/operators/add_op.h
+0
-0
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+1
-1
python/paddle/v2/framework/tests/test_add_two_op.py
python/paddle/v2/framework/tests/test_add_two_op.py
+1
-1
python/paddle/v2/framework/tests/test_gradient_checker.py
python/paddle/v2/framework/tests/test_gradient_checker.py
+1
-1
python/paddle/v2/framework/tests/test_net.py
python/paddle/v2/framework/tests/test_net.py
+2
-2
python/paddle/v2/framework/tests/test_operator.py
python/paddle/v2/framework/tests/test_operator.py
+2
-2
python/paddle/v2/framework/tests/test_recurrent_op.py
python/paddle/v2/framework/tests/test_recurrent_op.py
+1
-1
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
020e45f7
...
@@ -25,7 +25,7 @@ cc_test(operator_test SRCS operator_test.cc DEPS operator op_registry)
...
@@ -25,7 +25,7 @@ cc_test(operator_test SRCS operator_test.cc DEPS operator op_registry)
cc_library
(
grad_op_builder SRCS grad_op_builder.cc DEPS operator
)
cc_library
(
grad_op_builder SRCS grad_op_builder.cc DEPS operator
)
cc_library
(
op_registry SRCS op_registry.cc DEPS grad_op_builder
)
cc_library
(
op_registry SRCS op_registry.cc DEPS grad_op_builder
)
cc_test
(
op_registry_test SRCS op_registry_test.cc DEPS op_registry
)
cc_test
(
op_registry_test SRCS op_registry_test.cc DEPS op_registry
)
cc_test
(
grad_op_builder_test SRCS grad_op_builder_test.cc DEPS grad_op_builder op_registry add_
two_
op
)
cc_test
(
grad_op_builder_test SRCS grad_op_builder_test.cc DEPS grad_op_builder op_registry add_op
)
py_proto_compile
(
framework_py_proto SRCS framework.proto
)
py_proto_compile
(
framework_py_proto SRCS framework.proto
)
# Generate an empty __init__.py to make framework_py_proto as a valid python module.
# Generate an empty __init__.py to make framework_py_proto as a valid python module.
...
...
paddle/framework/grad_op_builder_test.cc
浏览文件 @
020e45f7
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include "paddle/framework/op_registry.h"
#include "paddle/framework/op_registry.h"
#include "paddle/framework/operator.h"
#include "paddle/framework/operator.h"
USE_OP
(
add
_two
);
USE_OP
(
add
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -41,7 +41,7 @@ namespace f = paddle::framework;
...
@@ -41,7 +41,7 @@ namespace f = paddle::framework;
TEST
(
GradOpBuilder
,
AddTwo
)
{
TEST
(
GradOpBuilder
,
AddTwo
)
{
std
::
shared_ptr
<
f
::
OperatorBase
>
add_op
(
f
::
OpRegistry
::
CreateOp
(
std
::
shared_ptr
<
f
::
OperatorBase
>
add_op
(
f
::
OpRegistry
::
CreateOp
(
"add
_two
"
,
{{
"X"
,
{
"x"
}},
{
"Y"
,
{
"y"
}}},
{{
"Out"
,
{
"out"
}}},
{}));
"add"
,
{{
"X"
,
{
"x"
}},
{
"Y"
,
{
"y"
}}},
{{
"Out"
,
{
"out"
}}},
{}));
std
::
shared_ptr
<
f
::
OperatorBase
>
grad_add_op
=
std
::
shared_ptr
<
f
::
OperatorBase
>
grad_add_op
=
f
::
OpRegistry
::
CreateGradOp
(
*
add_op
);
f
::
OpRegistry
::
CreateGradOp
(
*
add_op
);
EXPECT_EQ
(
grad_add_op
->
Inputs
().
size
(),
4UL
);
EXPECT_EQ
(
grad_add_op
->
Inputs
().
size
(),
4UL
);
...
...
paddle/operators/add_
two_
op.cc
→
paddle/operators/add_op.cc
浏览文件 @
020e45f7
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "paddle/operators/add_
two_
op.h"
#include "paddle/operators/add_op.h"
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -57,7 +57,6 @@ class AddOpGrad : public framework::OperatorWithKernel {
...
@@ -57,7 +57,6 @@ class AddOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
add
_two
,
ops
::
AddOp
,
ops
::
AddOpMaker
,
add_two
_grad
,
ops
::
AddOpGrad
);
REGISTER_OP
(
add
,
ops
::
AddOp
,
ops
::
AddOpMaker
,
add
_grad
,
ops
::
AddOpGrad
);
REGISTER_OP_CPU_KERNEL
(
add_two
,
REGISTER_OP_CPU_KERNEL
(
add
,
ops
::
AddKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
ops
::
AddKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
paddle/operators/add_
two_
op.cu
→
paddle/operators/add_op.cu
浏览文件 @
020e45f7
...
@@ -14,8 +14,7 @@
...
@@ -14,8 +14,7 @@
#define EIGEN_USE_GPU
#define EIGEN_USE_GPU
#include "paddle/framework/op_registry.h"
#include "paddle/framework/op_registry.h"
#include "paddle/operators/add_
two_
op.h"
#include "paddle/operators/add_op.h"
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_GPU_KERNEL
(
add_two
,
REGISTER_OP_GPU_KERNEL
(
add
,
ops
::
AddKernel
<
paddle
::
platform
::
GPUPlace
,
float
>
);
ops
::
AddKernel
<
paddle
::
platform
::
GPUPlace
,
float
>
);
paddle/operators/add_
two_
op.h
→
paddle/operators/add_op.h
浏览文件 @
020e45f7
文件已移动
paddle/pybind/pybind.cc
浏览文件 @
020e45f7
...
@@ -30,7 +30,7 @@ limitations under the License. */
...
@@ -30,7 +30,7 @@ limitations under the License. */
namespace
py
=
pybind11
;
namespace
py
=
pybind11
;
USE_OP
(
add
_two
);
USE_OP
(
add
);
USE_OP
(
onehot_cross_entropy
);
USE_OP
(
onehot_cross_entropy
);
USE_OP
(
sgd
);
USE_OP
(
sgd
);
USE_OP
(
mul
);
USE_OP
(
mul
);
...
...
python/paddle/v2/framework/tests/test_add_two_op.py
浏览文件 @
020e45f7
...
@@ -11,7 +11,7 @@ class TestAddOp(unittest.TestCase):
...
@@ -11,7 +11,7 @@ class TestAddOp(unittest.TestCase):
__metaclass__
=
OpTestMeta
__metaclass__
=
OpTestMeta
def
setUp
(
self
):
def
setUp
(
self
):
self
.
type
=
"add
_two
"
self
.
type
=
"add"
self
.
inputs
=
{
self
.
inputs
=
{
'X'
:
numpy
.
random
.
random
((
102
,
105
)).
astype
(
"float32"
),
'X'
:
numpy
.
random
.
random
((
102
,
105
)).
astype
(
"float32"
),
'Y'
:
numpy
.
random
.
random
((
102
,
105
)).
astype
(
"float32"
)
'Y'
:
numpy
.
random
.
random
((
102
,
105
)).
astype
(
"float32"
)
...
...
python/paddle/v2/framework/tests/test_gradient_checker.py
浏览文件 @
020e45f7
...
@@ -7,7 +7,7 @@ from gradient_checker import get_numeric_gradient
...
@@ -7,7 +7,7 @@ from gradient_checker import get_numeric_gradient
class
GetNumericGradientTest
(
unittest
.
TestCase
):
class
GetNumericGradientTest
(
unittest
.
TestCase
):
def
test_add_op
(
self
):
def
test_add_op
(
self
):
add_op
=
Operator
(
'add
_two
'
,
X
=
"X"
,
Y
=
"Y"
,
Out
=
"Z"
)
add_op
=
Operator
(
'add'
,
X
=
"X"
,
Y
=
"Y"
,
Out
=
"Z"
)
x
=
numpy
.
random
.
random
((
10
,
1
)).
astype
(
"float32"
)
x
=
numpy
.
random
.
random
((
10
,
1
)).
astype
(
"float32"
)
y
=
numpy
.
random
.
random
((
10
,
1
)).
astype
(
"float32"
)
y
=
numpy
.
random
.
random
((
10
,
1
)).
astype
(
"float32"
)
...
...
python/paddle/v2/framework/tests/test_net.py
浏览文件 @
020e45f7
...
@@ -15,7 +15,7 @@ def fc(X, W, Y):
...
@@ -15,7 +15,7 @@ def fc(X, W, Y):
class
TestNet
(
unittest
.
TestCase
):
class
TestNet
(
unittest
.
TestCase
):
def
test_net_all
(
self
):
def
test_net_all
(
self
):
net
=
core
.
Net
.
create
()
net
=
core
.
Net
.
create
()
op1
=
Operator
(
"add
_two
"
,
X
=
"X"
,
Y
=
"Y"
,
Out
=
"Out"
)
op1
=
Operator
(
"add"
,
X
=
"X"
,
Y
=
"Y"
,
Out
=
"Out"
)
net
.
append_op
(
op1
)
net
.
append_op
(
op1
)
net2
=
core
.
Net
.
create
()
net2
=
core
.
Net
.
create
()
...
@@ -26,7 +26,7 @@ class TestNet(unittest.TestCase):
...
@@ -26,7 +26,7 @@ class TestNet(unittest.TestCase):
expected
=
'''
expected
=
'''
Op(plain_net), inputs:{all[W, X, Y]}, outputs:{all[Out, fc.out, pre_activation]}.
Op(plain_net), inputs:{all[W, X, Y]}, outputs:{all[Out, fc.out, pre_activation]}.
Op(add
_two
), inputs:{X[X], Y[Y]}, outputs:{Out[Out]}.
Op(add), inputs:{X[X], Y[Y]}, outputs:{Out[Out]}.
Op(plain_net), inputs:{all[W, X]}, outputs:{all[fc.out, pre_activation]}.
Op(plain_net), inputs:{all[W, X]}, outputs:{all[fc.out, pre_activation]}.
Op(plain_net), inputs:{all[W, X]}, outputs:{all[fc.out, pre_activation]}.
Op(plain_net), inputs:{all[W, X]}, outputs:{all[fc.out, pre_activation]}.
Op(mul), inputs:{X[X], Y[W]}, outputs:{Out[pre_activation]}.
Op(mul), inputs:{X[X], Y[W]}, outputs:{Out[pre_activation]}.
...
...
python/paddle/v2/framework/tests/test_operator.py
浏览文件 @
020e45f7
...
@@ -193,10 +193,10 @@ class TestOpDescCreationMethod(unittest.TestCase):
...
@@ -193,10 +193,10 @@ class TestOpDescCreationMethod(unittest.TestCase):
class
TestOpCreations
(
unittest
.
TestCase
):
class
TestOpCreations
(
unittest
.
TestCase
):
def
test_all
(
self
):
def
test_all
(
self
):
add_op
=
op
.
Operator
(
"add
_two
"
,
X
=
"a"
,
Y
=
"b"
,
Out
=
"z"
)
add_op
=
op
.
Operator
(
"add"
,
X
=
"a"
,
Y
=
"b"
,
Out
=
"z"
)
self
.
assertIsNotNone
(
add_op
)
self
.
assertIsNotNone
(
add_op
)
# Invoke C++ DebugString()
# Invoke C++ DebugString()
self
.
assertEqual
(
'Op(add
_two
), inputs:{X[a], Y[b]}, outputs:{Out[z]}.'
,
self
.
assertEqual
(
'Op(add), inputs:{X[a], Y[b]}, outputs:{Out[z]}.'
,
str
(
add_op
))
str
(
add_op
))
...
...
python/paddle/v2/framework/tests/test_recurrent_op.py
浏览文件 @
020e45f7
...
@@ -146,7 +146,7 @@ class TestRecurrentOp(unittest.TestCase):
...
@@ -146,7 +146,7 @@ class TestRecurrentOp(unittest.TestCase):
stepnet
=
core
.
Net
.
create
()
stepnet
=
core
.
Net
.
create
()
x_fc_op
=
Operator
(
"mul"
,
X
=
"x@alias"
,
Y
=
"W"
,
Out
=
"Wx"
)
x_fc_op
=
Operator
(
"mul"
,
X
=
"x@alias"
,
Y
=
"W"
,
Out
=
"Wx"
)
h_fc_op
=
Operator
(
"mul"
,
X
=
"h@pre"
,
Y
=
"U"
,
Out
=
"Uh"
)
h_fc_op
=
Operator
(
"mul"
,
X
=
"h@pre"
,
Y
=
"U"
,
Out
=
"Uh"
)
sum_op
=
Operator
(
"add
_two
"
,
X
=
"Wx"
,
Y
=
"Uh"
,
Out
=
"sum"
)
sum_op
=
Operator
(
"add"
,
X
=
"Wx"
,
Y
=
"Uh"
,
Out
=
"sum"
)
sig_op
=
Operator
(
"sigmoid"
,
X
=
"sum"
,
Y
=
"h@alias"
)
sig_op
=
Operator
(
"sigmoid"
,
X
=
"sum"
,
Y
=
"h@alias"
)
for
op
in
[
x_fc_op
,
h_fc_op
,
sum_op
,
sig_op
]:
for
op
in
[
x_fc_op
,
h_fc_op
,
sum_op
,
sig_op
]:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录