Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
5b93ac77
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5b93ac77
编写于
9月 04, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
package a new USE_NO_KERNEL_OP for USE_OP_ITSELF
上级
409ac4a3
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
14 addition
and
6 deletion
+14
-6
doc/howto/dev/new_op_cn.md
doc/howto/dev/new_op_cn.md
+6
-0
paddle/framework/backward.cc
paddle/framework/backward.cc
+1
-1
paddle/framework/op_registry.h
paddle/framework/op_registry.h
+2
-0
paddle/operators/minus_op.cc
paddle/operators/minus_op.cc
+1
-1
paddle/operators/recurrent_op.cc
paddle/operators/recurrent_op.cc
+1
-1
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+2
-2
python/paddle/v2/framework/op.py
python/paddle/v2/framework/op.py
+1
-1
未找到文件。
doc/howto/dev/new_op_cn.md
浏览文件 @
5b93ac77
...
@@ -227,6 +227,12 @@ make mul_op
...
@@ -227,6 +227,12 @@ make mul_op
USE_CPU_ONLY_OP(gather);
USE_CPU_ONLY_OP(gather);
```
```
如果OP不带Kernel,则使用`USE_NO_KENREL_OP`:
```
USE_NO_KENREL_OP(recurrent);
```
使用`USE_OP`告知编译器需要链接该Op的目标文件,具体解释参考[代码注释](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/op_registry.h#L81)。
使用`USE_OP`告知编译器需要链接该Op的目标文件,具体解释参考[代码注释](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/op_registry.h#L81)。
...
...
paddle/framework/backward.cc
浏览文件 @
5b93ac77
...
@@ -182,7 +182,7 @@ static std::unique_ptr<OperatorBase> BackwardRecursive(
...
@@ -182,7 +182,7 @@ static std::unique_ptr<OperatorBase> BackwardRecursive(
});
});
// process recurrent gradient op as a special operator.
// process recurrent gradient op as a special operator.
if
(
forwardOp
.
Type
()
==
"recurrent
_op
"
)
{
if
(
forwardOp
.
Type
()
==
"recurrent"
)
{
// NOTE clean up cycle call somewhere (RNN's stepnet constains itself), or
// NOTE clean up cycle call somewhere (RNN's stepnet constains itself), or
// this will result in infinite loop.
// this will result in infinite loop.
const
auto
&
rnnop
=
const
auto
&
rnnop
=
...
...
paddle/framework/op_registry.h
浏览文件 @
5b93ac77
...
@@ -194,6 +194,8 @@ class OpKernelRegistrar : public Registrar {
...
@@ -194,6 +194,8 @@ class OpKernelRegistrar : public Registrar {
USE_OP_DEVICE_KERNEL(op_type, GPU)
USE_OP_DEVICE_KERNEL(op_type, GPU)
#endif
#endif
#define USE_NO_KERNEL_OP(op_type) USE_OP_ITSELF(op_type);
#define USE_CPU_ONLY_OP(op_type) \
#define USE_CPU_ONLY_OP(op_type) \
USE_OP_ITSELF(op_type); \
USE_OP_ITSELF(op_type); \
USE_OP_DEVICE_KERNEL(op_type, CPU);
USE_OP_DEVICE_KERNEL(op_type, CPU);
...
...
paddle/operators/minus_op.cc
浏览文件 @
5b93ac77
...
@@ -79,7 +79,7 @@ class MinusGradOp : public NetOp {
...
@@ -79,7 +79,7 @@ class MinusGradOp : public NetOp {
}
// namespace paddle
}
// namespace paddle
USE_OP
(
scale
);
USE_OP
(
scale
);
USE_
OP_ITSELF
(
identity
);
USE_
NO_KERNEL_OP
(
identity
);
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
minus
,
ops
::
MinusOp
,
ops
::
MinusOpMaker
,
ops
::
MinusGradOp
<
float
>
);
REGISTER_OP
(
minus
,
ops
::
MinusOp
,
ops
::
MinusOpMaker
,
ops
::
MinusGradOp
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
minus
,
REGISTER_OP_CPU_KERNEL
(
minus
,
...
...
paddle/operators/recurrent_op.cc
浏览文件 @
5b93ac77
...
@@ -235,5 +235,5 @@ RecurrentGradientOp::RecurrentGradientOp(
...
@@ -235,5 +235,5 @@ RecurrentGradientOp::RecurrentGradientOp(
}
// namespace paddle
}
// namespace paddle
REGISTER_OP_WITHOUT_GRADIENT
(
REGISTER_OP_WITHOUT_GRADIENT
(
recurrent
_op
,
paddle
::
operators
::
RecurrentOp
,
recurrent
,
paddle
::
operators
::
RecurrentOp
,
paddle
::
operators
::
RecurrentAlgorithmProtoAndCheckerMaker
);
paddle
::
operators
::
RecurrentAlgorithmProtoAndCheckerMaker
);
paddle/pybind/pybind.cc
浏览文件 @
5b93ac77
...
@@ -39,12 +39,12 @@ USE_OP(sigmoid);
...
@@ -39,12 +39,12 @@ USE_OP(sigmoid);
USE_OP
(
softmax
);
USE_OP
(
softmax
);
USE_OP
(
rowwise_add
);
USE_OP
(
rowwise_add
);
USE_OP
(
fill_zeros_like
);
USE_OP
(
fill_zeros_like
);
USE_
OP_ITSELF
(
recurrent_op
);
USE_
NO_KERNEL_OP
(
recurrent
);
USE_OP
(
gaussian_random
);
USE_OP
(
gaussian_random
);
USE_OP
(
uniform_random
);
USE_OP
(
uniform_random
);
USE_OP
(
lookup_table
);
USE_OP
(
lookup_table
);
USE_OP
(
scale
);
USE_OP
(
scale
);
USE_
OP_ITSELF
(
identity
);
USE_
NO_KERNEL_OP
(
identity
);
USE_OP
(
minus
);
USE_OP
(
minus
);
USE_CPU_ONLY_OP
(
gather
);
USE_CPU_ONLY_OP
(
gather
);
USE_CPU_ONLY_OP
(
scatter
);
USE_CPU_ONLY_OP
(
scatter
);
...
...
python/paddle/v2/framework/op.py
浏览文件 @
5b93ac77
...
@@ -179,7 +179,7 @@ class OperatorFactory(object):
...
@@ -179,7 +179,7 @@ class OperatorFactory(object):
class
__RecurrentOp__
(
object
):
class
__RecurrentOp__
(
object
):
__proto__
=
None
__proto__
=
None
type
=
'recurrent
_op
'
type
=
'recurrent'
def
__init__
(
self
):
def
__init__
(
self
):
# cache recurrent_op's proto
# cache recurrent_op's proto
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录