Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a829357e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
a829357e
编写于
11月 13, 2020
作者:
Z
Zhong Hui
提交者:
GitHub
11月 13, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
register the op version for some ops
register the op version for some ops
上级
5579edfb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
12 deletion
+37
-12
paddle/fluid/operators/clip_op.cc
paddle/fluid/operators/clip_op.cc
+14
-0
paddle/fluid/operators/controlflow/compare_op.cc
paddle/fluid/operators/controlflow/compare_op.cc
+23
-12
未找到文件。
paddle/fluid/operators/clip_op.cc
浏览文件 @
a829357e
...
@@ -14,6 +14,8 @@ limitations under the License. */
...
@@ -14,6 +14,8 @@ limitations under the License. */
#include "paddle/fluid/operators/clip_op.h"
#include "paddle/fluid/operators/clip_op.h"
#include <memory>
#include <memory>
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_version_registry.h"
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -122,3 +124,15 @@ REGISTER_OP_CPU_KERNEL(
...
@@ -122,3 +124,15 @@ REGISTER_OP_CPU_KERNEL(
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
clip_grad
,
ops
::
ClipGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
clip_grad
,
ops
::
ClipGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ClipGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
ClipGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
REGISTER_OP_VERSION
(
clip
)
.
AddCheckpoint
(
R"ROC(
Upgrade clip add a new input [Min])ROC"
,
paddle
::
framework
::
compatible
::
OpVersionDesc
()
.
NewInput
(
"Min"
,
"Pass the mix, min value as input, not attribute. Min is "
"dispensable."
)
.
NewInput
(
"Max"
,
"Pass the mix, min value as input, not attribute. Max is "
"dispensable."
));
paddle/fluid/operators/controlflow/compare_op.cc
浏览文件 @
a829357e
...
@@ -17,6 +17,7 @@ limitations under the License. */
...
@@ -17,6 +17,7 @@ limitations under the License. */
#include <string>
#include <string>
#include <vector>
#include <vector>
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_version_registry.h"
#include "paddle/fluid/operators/elementwise/elementwise_op_function.h"
#include "paddle/fluid/operators/elementwise/elementwise_op_function.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -128,6 +129,15 @@ class CompareOp : public framework::OperatorWithKernel {
...
@@ -128,6 +129,15 @@ class CompareOp : public framework::OperatorWithKernel {
}
// namespace operators
}
// namespace operators
}
// namespace paddle
}
// namespace paddle
#define REGISTER_COMPARE_OP_VERSION(op_type) \
REGISTER_OP_VERSION(op_type) \
.AddCheckpoint( \
R"ROC(Upgrade compare ops, add a new attribute [force_cpu])ROC", \
paddle::framework::compatible::OpVersionDesc().NewAttr( \
"force_cpu", \
"In order to force fill output variable to cpu memory.", \
false));
#define REGISTER_COMPARE_OP(op_type, _equation) \
#define REGISTER_COMPARE_OP(op_type, _equation) \
struct _##op_type##Comment { \
struct _##op_type##Comment { \
static char type[]; \
static char type[]; \
...
@@ -139,7 +149,8 @@ class CompareOp : public framework::OperatorWithKernel {
...
@@ -139,7 +149,8 @@ class CompareOp : public framework::OperatorWithKernel {
op_type, ::paddle::operators::CompareOp<_##op_type##Comment>, \
op_type, ::paddle::operators::CompareOp<_##op_type##Comment>, \
::paddle::operators::CompareOpProtoMaker<_##op_type##Comment>, \
::paddle::operators::CompareOpProtoMaker<_##op_type##Comment>, \
::paddle::framework::EmptyGradOpMaker<paddle::framework::OpDesc>, \
::paddle::framework::EmptyGradOpMaker<paddle::framework::OpDesc>, \
::paddle::framework::EmptyGradOpMaker<paddle::imperative::OpBase>);
::paddle::framework::EmptyGradOpMaker<paddle::imperative::OpBase>); \
REGISTER_COMPARE_OP_VERSION(op_type);
REGISTER_COMPARE_OP
(
less_than
,
"Out = X < Y"
);
REGISTER_COMPARE_OP
(
less_than
,
"Out = X < Y"
);
REGISTER_COMPARE_KERNEL
(
less_than
,
CPU
,
paddle
::
operators
::
LessThanFunctor
);
REGISTER_COMPARE_KERNEL
(
less_than
,
CPU
,
paddle
::
operators
::
LessThanFunctor
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录