Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
d84cdb7b
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看板
未验证
提交
d84cdb7b
编写于
4月 18, 2018
作者:
T
Tao Luo
提交者:
GitHub
4月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9911 from tonyyang-svail/unify_op_registry
Unify REGISTER_OP and REGISTER_OPERATOR
上级
1fd12840
68d96385
变更
67
显示空白变更内容
内联
并排
Showing
67 changed file
with
379 addition
and
274 deletion
+379
-274
paddle/fluid/framework/grad_op_desc_maker.h
paddle/fluid/framework/grad_op_desc_maker.h
+2
-2
paddle/fluid/framework/op_registry.h
paddle/fluid/framework/op_registry.h
+2
-30
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+3
-3
paddle/fluid/operators/activation_op.cc
paddle/fluid/operators/activation_op.cc
+116
-85
paddle/fluid/operators/bilinear_tensor_product_op.cc
paddle/fluid/operators/bilinear_tensor_product_op.cc
+5
-3
paddle/fluid/operators/clip_op.cc
paddle/fluid/operators/clip_op.cc
+3
-2
paddle/fluid/operators/concat_op.cc
paddle/fluid/operators/concat_op.cc
+4
-2
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+9
-6
paddle/fluid/operators/conv_shift_op.cc
paddle/fluid/operators/conv_shift_op.cc
+3
-2
paddle/fluid/operators/conv_transpose_op.cc
paddle/fluid/operators/conv_transpose_op.cc
+8
-4
paddle/fluid/operators/cos_sim_op.cc
paddle/fluid/operators/cos_sim_op.cc
+3
-2
paddle/fluid/operators/crop_op.cc
paddle/fluid/operators/crop_op.cc
+3
-1
paddle/fluid/operators/cross_entropy_op.cc
paddle/fluid/operators/cross_entropy_op.cc
+3
-2
paddle/fluid/operators/dropout_op.cc
paddle/fluid/operators/dropout_op.cc
+3
-2
paddle/fluid/operators/elementwise_div_op.cc
paddle/fluid/operators/elementwise_div_op.cc
+4
-2
paddle/fluid/operators/elementwise_max_op.cc
paddle/fluid/operators/elementwise_max_op.cc
+4
-2
paddle/fluid/operators/elementwise_min_op.cc
paddle/fluid/operators/elementwise_min_op.cc
+4
-2
paddle/fluid/operators/elementwise_mul_op.cc
paddle/fluid/operators/elementwise_mul_op.cc
+4
-2
paddle/fluid/operators/elementwise_sub_op.cc
paddle/fluid/operators/elementwise_sub_op.cc
+4
-2
paddle/fluid/operators/expand_op.cc
paddle/fluid/operators/expand_op.cc
+5
-2
paddle/fluid/operators/fc_op.cc
paddle/fluid/operators/fc_op.cc
+3
-2
paddle/fluid/operators/gather_op.cc
paddle/fluid/operators/gather_op.cc
+3
-2
paddle/fluid/operators/gru_op.cc
paddle/fluid/operators/gru_op.cc
+3
-1
paddle/fluid/operators/gru_unit_op.cc
paddle/fluid/operators/gru_unit_op.cc
+3
-2
paddle/fluid/operators/hinge_loss_op.cc
paddle/fluid/operators/hinge_loss_op.cc
+3
-2
paddle/fluid/operators/huber_loss_op.cc
paddle/fluid/operators/huber_loss_op.cc
+3
-2
paddle/fluid/operators/im2sequence_op.cc
paddle/fluid/operators/im2sequence_op.cc
+3
-2
paddle/fluid/operators/l1_norm_op.cc
paddle/fluid/operators/l1_norm_op.cc
+3
-2
paddle/fluid/operators/label_smooth_op.cc
paddle/fluid/operators/label_smooth_op.cc
+3
-2
paddle/fluid/operators/layer_norm_op.cc
paddle/fluid/operators/layer_norm_op.cc
+3
-2
paddle/fluid/operators/linear_chain_crf_op.cc
paddle/fluid/operators/linear_chain_crf_op.cc
+4
-2
paddle/fluid/operators/lod_reset_op.cc
paddle/fluid/operators/lod_reset_op.cc
+3
-2
paddle/fluid/operators/log_loss_op.cc
paddle/fluid/operators/log_loss_op.cc
+3
-2
paddle/fluid/operators/lrn_op.cc
paddle/fluid/operators/lrn_op.cc
+3
-1
paddle/fluid/operators/lstm_op.cc
paddle/fluid/operators/lstm_op.cc
+3
-1
paddle/fluid/operators/lstm_unit_op.cc
paddle/fluid/operators/lstm_unit_op.cc
+3
-2
paddle/fluid/operators/lstmp_op.cc
paddle/fluid/operators/lstmp_op.cc
+3
-2
paddle/fluid/operators/margin_rank_loss_op.cc
paddle/fluid/operators/margin_rank_loss_op.cc
+4
-3
paddle/fluid/operators/matmul_op.cc
paddle/fluid/operators/matmul_op.cc
+3
-2
paddle/fluid/operators/maxout_op.cc
paddle/fluid/operators/maxout_op.cc
+3
-2
paddle/fluid/operators/modified_huber_loss_op.cc
paddle/fluid/operators/modified_huber_loss_op.cc
+4
-3
paddle/fluid/operators/mul_op.cc
paddle/fluid/operators/mul_op.cc
+3
-1
paddle/fluid/operators/nce_op.cc
paddle/fluid/operators/nce_op.cc
+5
-1
paddle/fluid/operators/norm_op.cc
paddle/fluid/operators/norm_op.cc
+3
-2
paddle/fluid/operators/pool_op.cc
paddle/fluid/operators/pool_op.cc
+6
-4
paddle/fluid/operators/pool_with_index_op.cc
paddle/fluid/operators/pool_with_index_op.cc
+8
-6
paddle/fluid/operators/prelu_op.cc
paddle/fluid/operators/prelu_op.cc
+3
-2
paddle/fluid/operators/rank_loss_op.cc
paddle/fluid/operators/rank_loss_op.cc
+3
-2
paddle/fluid/operators/reduce_op.cc
paddle/fluid/operators/reduce_op.cc
+24
-16
paddle/fluid/operators/reshape_op.cc
paddle/fluid/operators/reshape_op.cc
+3
-2
paddle/fluid/operators/roi_pool_op.cc
paddle/fluid/operators/roi_pool_op.cc
+3
-2
paddle/fluid/operators/row_conv_op.cc
paddle/fluid/operators/row_conv_op.cc
+3
-2
paddle/fluid/operators/scatter_op.cc
paddle/fluid/operators/scatter_op.cc
+3
-2
paddle/fluid/operators/sequence_concat_op.cc
paddle/fluid/operators/sequence_concat_op.cc
+5
-3
paddle/fluid/operators/sequence_conv_op.cc
paddle/fluid/operators/sequence_conv_op.cc
+5
-2
paddle/fluid/operators/sequence_expand_op.cc
paddle/fluid/operators/sequence_expand_op.cc
+4
-2
paddle/fluid/operators/sequence_slice_op.cc
paddle/fluid/operators/sequence_slice_op.cc
+4
-2
paddle/fluid/operators/sequence_softmax_op.cc
paddle/fluid/operators/sequence_softmax_op.cc
+4
-3
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
...e/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
+6
-5
paddle/fluid/operators/smooth_l1_loss_op.cc
paddle/fluid/operators/smooth_l1_loss_op.cc
+3
-2
paddle/fluid/operators/softmax_op.cc
paddle/fluid/operators/softmax_op.cc
+3
-2
paddle/fluid/operators/spp_op.cc
paddle/fluid/operators/spp_op.cc
+3
-1
paddle/fluid/operators/squared_l2_distance_op.cc
paddle/fluid/operators/squared_l2_distance_op.cc
+4
-3
paddle/fluid/operators/squared_l2_norm_op.cc
paddle/fluid/operators/squared_l2_norm_op.cc
+4
-2
paddle/fluid/operators/transpose_op.cc
paddle/fluid/operators/transpose_op.cc
+3
-2
paddle/fluid/operators/unpool_op.cc
paddle/fluid/operators/unpool_op.cc
+3
-2
paddle/fluid/operators/warpctc_op.cc
paddle/fluid/operators/warpctc_op.cc
+3
-2
未找到文件。
paddle/fluid/framework/grad_op_desc_maker.h
浏览文件 @
d84cdb7b
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#pragma once
#include <algorithm>
#include <string>
#include <string>
#include <unordered_set>
#include <unordered_set>
#include <vector>
#include <vector>
...
@@ -69,8 +70,7 @@ class GradOpDescMakerBase {
...
@@ -69,8 +70,7 @@ class GradOpDescMakerBase {
" for input argument with a list of variables, "
" for input argument with a list of variables, "
" drop_empty_grad is not allowed because it makes"
" drop_empty_grad is not allowed because it makes"
" the correspondence bewteen a variable and its gradient"
" the correspondence bewteen a variable and its gradient"
" ambiguous. Use REGISTER_OP_EX to register the op"
" ambiguous."
" or call InputGrad(?,false) in GradOpDescMaker."
" Op type %s"
,
" Op type %s"
,
fwd_op_
.
Type
());
fwd_op_
.
Type
());
...
...
paddle/fluid/framework/op_registry.h
浏览文件 @
d84cdb7b
...
@@ -16,6 +16,8 @@ limitations under the License. */
...
@@ -16,6 +16,8 @@ limitations under the License. */
#include <algorithm>
#include <algorithm>
#include <atomic>
#include <atomic>
#include <string>
#include <tuple>
#include <type_traits>
#include <type_traits>
#include <typeinfo>
#include <typeinfo>
#include <unordered_map>
#include <unordered_map>
...
@@ -141,36 +143,6 @@ class OpKernelRegistrar : public Registrar {
...
@@ -141,36 +143,6 @@ class OpKernelRegistrar : public Registrar {
return 0; \
return 0; \
}
}
/**
* Macro to register Operator. When the input is duplicable, you should
* use REGISTER_OP_EX with drop_empty_grad=false instead.
*/
#define REGISTER_OP(op_type, op_class, op_maker_class, grad_op_type, \
grad_op_class) \
REGISTER_OP_EX(op_type, op_class, op_maker_class, grad_op_type, \
grad_op_class, true)
// When an argument is duplicable, we need to use this version.
// Perhaps we can omit DropEmptyIG template parameter and
// only have one version of REGISTER_OP.
#define REGISTER_OP_EX(op_type, op_class, op_maker_class, grad_op_type, \
grad_op_class, drop_empty_grad) \
REGISTER_OPERATOR(grad_op_type, grad_op_class); \
class _GradOpDescMaker_##grad_op_type##_ \
: public ::paddle::framework::DefaultGradOpDescMaker<drop_empty_grad> { \
using ::paddle::framework::DefaultGradOpDescMaker< \
drop_empty_grad>::DefaultGradOpDescMaker; \
\
protected: \
virtual std::string GradOpType() const { return #grad_op_type; } \
}; \
REGISTER_OPERATOR(op_type, op_class, _GradOpDescMaker_##grad_op_type##_, \
op_maker_class);
#define REGISTER_OP_WITH_KERNEL(op_type, ...) \
REGISTER_OPERATOR(op_type, ::paddle::framework::OperatorWithKernel, \
##__VA_ARGS__)
#define REGISTER_OP_WITHOUT_GRADIENT(op_type, op_class, op_maker_class) \
#define REGISTER_OP_WITHOUT_GRADIENT(op_type, op_class, op_maker_class) \
REGISTER_OPERATOR(op_type, op_class, op_maker_class)
REGISTER_OPERATOR(op_type, op_class, op_maker_class)
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
d84cdb7b
...
@@ -110,12 +110,12 @@ function(op_library TARGET)
...
@@ -110,12 +110,12 @@ function(op_library TARGET)
# Note that it's enough to just adding one operator to pybind in a *_op.cc file.
# Note that it's enough to just adding one operator to pybind in a *_op.cc file.
# And for detail pybind information, please see generated paddle/pybind/pybind.h.
# And for detail pybind information, please see generated paddle/pybind/pybind.h.
file
(
READ
${
TARGET
}
.cc TARGET_CONTENT
)
file
(
READ
${
TARGET
}
.cc TARGET_CONTENT
)
string
(
REGEX MATCH
"REGISTER_OP
\\
(.*REGISTER_OP
\\
("
multi_register
"
${
TARGET_CONTENT
}
"
)
string
(
REGEX MATCH
"REGISTER_OP
ERATOR
\\
(.*REGISTER_OPERATOR
\\
("
multi_register
"
${
TARGET_CONTENT
}
"
)
string
(
REGEX MATCH
"REGISTER_OP
\\
([a-z0-9_]*,"
one_register
"
${
multi_register
}
"
)
string
(
REGEX MATCH
"REGISTER_OP
ERATOR
\\
([a-z0-9_]*,"
one_register
"
${
multi_register
}
"
)
if
(
one_register STREQUAL
""
)
if
(
one_register STREQUAL
""
)
string
(
REPLACE
"_op"
""
TARGET
"
${
TARGET
}
"
)
string
(
REPLACE
"_op"
""
TARGET
"
${
TARGET
}
"
)
else
()
else
()
string
(
REPLACE
"REGISTER_OP("
""
TARGET
"
${
one_register
}
"
)
string
(
REPLACE
"REGISTER_OP
ERATOR
("
""
TARGET
"
${
one_register
}
"
)
string
(
REPLACE
","
""
TARGET
"
${
TARGET
}
"
)
string
(
REPLACE
","
""
TARGET
"
${
TARGET
}
"
)
endif
()
endif
()
...
...
paddle/fluid/operators/activation_op.cc
浏览文件 @
d84cdb7b
...
@@ -558,95 +558,126 @@ $$out = \frac{x}{1 + e^{- \beta x}}$$
...
@@ -558,95 +558,126 @@ $$out = \frac{x}{1 + e^{- \beta x}}$$
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sigmoid
,
ops
::
ActivationOp
,
ops
::
SigmoidOpMaker
,
sigmoid_grad
,
REGISTER_OPERATOR
(
sigmoid
,
ops
::
ActivationOp
,
ops
::
SigmoidOpMaker
,
ops
::
ActivationOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sigmoid_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
logsigmoid
,
ops
::
ActivationOp
,
ops
::
LogSigmoidOpMaker
,
REGISTER_OPERATOR
(
logsigmoid
,
ops
::
ActivationOp
,
ops
::
LogSigmoidOpMaker
,
logsigmoid_grad
,
ops
::
ActivationOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
logsigmoid_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
exp
,
ops
::
ActivationOp
,
ops
::
ExpOpMaker
,
exp_grad
,
REGISTER_OPERATOR
(
exp
,
ops
::
ActivationOp
,
ops
::
ExpOpMaker
,
ops
::
ActivationOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
exp_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
relu
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
ReluOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
relu_grad
,
ops
::
ActivationWithMKLDNNOpGrad
)
REGISTER_OPERATOR
(
tanh
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
TanhOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
tanh_grad
,
ops
::
ActivationWithMKLDNNOpGrad
)
REGISTER_OPERATOR
(
tanh_shrink
,
ops
::
ActivationOp
,
ops
::
TanhShrinkOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
tanh_shrink_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
softshrink
,
ops
::
ActivationOp
,
ops
::
SoftShrinkOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
softshrink_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
sqrt
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
SqrtOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sqrt_grad
,
ops
::
ActivationWithMKLDNNOpGrad
)
REGISTER_OPERATOR
(
abs
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
AbsOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
abs_grad
,
ops
::
ActivationWithMKLDNNOpGrad
)
REGISTER_OPERATOR
(
ceil
,
ops
::
ActivationOp
,
ops
::
CeilOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
ceil_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
floor
,
ops
::
ActivationOp
,
ops
::
FloorOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
floor_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
cos
,
ops
::
ActivationOp
,
ops
::
CosOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
cos_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
sin
,
ops
::
ActivationOp
,
ops
::
SinOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sin_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
round
,
ops
::
ActivationOp
,
ops
::
RoundOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
round_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
reciprocal
,
ops
::
ActivationOp
,
ops
::
ReciprocalOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reciprocal_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
log
,
ops
::
ActivationOp
,
ops
::
LogOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
log_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
square
,
ops
::
ActivationOp
,
ops
::
SquareOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
square_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
softplus
,
ops
::
ActivationOp
,
ops
::
SoftplusOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
softplus_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
softsign
,
ops
::
ActivationOp
,
ops
::
SoftsignOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
softsign_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
brelu
,
ops
::
ActivationOp
,
ops
::
BReluOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
brelu_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
leaky_relu
,
ops
::
ActivationOp
,
ops
::
LeakyReluOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
leaky_relu_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
soft_relu
,
ops
::
ActivationOp
,
ops
::
SoftReluOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
soft_relu_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
elu
,
ops
::
ActivationOp
,
ops
::
ELUOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elu_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
relu6
,
ops
::
ActivationOp
,
ops
::
Relu6OpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
relu6_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
pow
,
ops
::
ActivationOp
,
ops
::
PowOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
pow_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OPERATOR
(
stanh
,
ops
::
ActivationOp
,
ops
::
STanhOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
stanh_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
relu
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
ReluOpMaker
,
relu_grad
,
REGISTER_OPERATOR
(
hard_shrink
,
ops
::
ActivationOp
,
ops
::
HardShrinkOpMaker
,
ops
::
ActivationWithMKLDNNOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
hard_shrink_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
tanh
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
TanhOpMaker
,
tanh_grad
,
REGISTER_OPERATOR
(
thresholded_relu
,
ops
::
ActivationOp
,
ops
::
ActivationWithMKLDNNOpGrad
);
ops
::
ThresholdedReluOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OP
(
tanh_shrink
,
ops
::
ActivationOp
,
ops
::
TanhShrinkOpMaker
,
REGISTER_OPERATOR
(
thresholded_relu_grad
,
ops
::
ActivationOpGrad
)
tanh_shrink_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OPERATOR
(
hard_sigmoid
,
ops
::
ActivationOp
,
ops
::
HardSigmoidOpMaker
,
REGISTER_OP
(
softshrink
,
ops
::
ActivationOp
,
ops
::
SoftShrinkOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
softshrink_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OPERATOR
(
hard_sigmoid_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
sqrt
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
SqrtOpMaker
,
sqrt_grad
,
REGISTER_OPERATOR
(
swish
,
ops
::
ActivationOp
,
ops
::
SwishOpMaker
,
ops
::
ActivationWithMKLDNNOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
swish_grad
,
ops
::
ActivationOpGrad
)
REGISTER_OP
(
abs
,
ops
::
ActivationWithMKLDNNOp
,
ops
::
AbsOpMaker
,
abs_grad
,
ops
::
ActivationWithMKLDNNOpGrad
);
REGISTER_OP
(
ceil
,
ops
::
ActivationOp
,
ops
::
CeilOpMaker
,
ceil_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
floor
,
ops
::
ActivationOp
,
ops
::
FloorOpMaker
,
floor_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
cos
,
ops
::
ActivationOp
,
ops
::
CosOpMaker
,
cos_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
sin
,
ops
::
ActivationOp
,
ops
::
SinOpMaker
,
sin_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
round
,
ops
::
ActivationOp
,
ops
::
RoundOpMaker
,
round_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
reciprocal
,
ops
::
ActivationOp
,
ops
::
ReciprocalOpMaker
,
reciprocal_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
log
,
ops
::
ActivationOp
,
ops
::
LogOpMaker
,
log_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
square
,
ops
::
ActivationOp
,
ops
::
SquareOpMaker
,
square_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
softplus
,
ops
::
ActivationOp
,
ops
::
SoftplusOpMaker
,
softplus_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
softsign
,
ops
::
ActivationOp
,
ops
::
SoftsignOpMaker
,
softsign_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
brelu
,
ops
::
ActivationOp
,
ops
::
BReluOpMaker
,
brelu_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
leaky_relu
,
ops
::
ActivationOp
,
ops
::
LeakyReluOpMaker
,
leaky_relu_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
soft_relu
,
ops
::
ActivationOp
,
ops
::
SoftReluOpMaker
,
soft_relu_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
elu
,
ops
::
ActivationOp
,
ops
::
ELUOpMaker
,
elu_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
relu6
,
ops
::
ActivationOp
,
ops
::
Relu6OpMaker
,
relu6_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
pow
,
ops
::
ActivationOp
,
ops
::
PowOpMaker
,
pow_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
stanh
,
ops
::
ActivationOp
,
ops
::
STanhOpMaker
,
stanh_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
hard_shrink
,
ops
::
ActivationOp
,
ops
::
HardShrinkOpMaker
,
hard_shrink_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
thresholded_relu
,
ops
::
ActivationOp
,
ops
::
ThresholdedReluOpMaker
,
thresholded_relu_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
hard_sigmoid
,
ops
::
ActivationOp
,
ops
::
HardSigmoidOpMaker
,
hard_sigmoid_grad
,
ops
::
ActivationOpGrad
);
REGISTER_OP
(
swish
,
ops
::
ActivationOp
,
ops
::
SwishOpMaker
,
swish_grad
,
ops
::
ActivationOpGrad
);
#define REGISTER_ACTIVATION_CPU_KERNEL(act_type, functor, grad_functor) \
#define REGISTER_ACTIVATION_CPU_KERNEL(act_type, functor, grad_functor) \
REGISTER_OP_CPU_KERNEL( \
REGISTER_OP_CPU_KERNEL( \
...
...
paddle/fluid/operators/bilinear_tensor_product_op.cc
浏览文件 @
d84cdb7b
...
@@ -153,9 +153,11 @@ class BilinearTensorProductOpGrad : public framework::OperatorWithKernel {
...
@@ -153,9 +153,11 @@ class BilinearTensorProductOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
bilinear_tensor_product
,
ops
::
BilinearTensorProductOp
,
REGISTER_OPERATOR
(
bilinear_tensor_product
,
ops
::
BilinearTensorProductOp
,
ops
::
BilinearTensorProductOpMaker
,
bilinear_tensor_product_grad
,
ops
::
BilinearTensorProductOpMaker
,
ops
::
BilinearTensorProductOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
bilinear_tensor_product_grad
,
ops
::
BilinearTensorProductOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
bilinear_tensor_product
,
bilinear_tensor_product
,
ops
::
BilinearTensorProductKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
BilinearTensorProductKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/clip_op.cc
浏览文件 @
d84cdb7b
...
@@ -81,8 +81,9 @@ class ClipOpGrad : public framework::OperatorWithKernel {
...
@@ -81,8 +81,9 @@ class ClipOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
clip
,
ops
::
ClipOp
,
ops
::
ClipOpMaker
<
float
>
,
clip_grad
,
REGISTER_OPERATOR
(
clip
,
ops
::
ClipOp
,
ops
::
ClipOpMaker
<
float
>
,
ops
::
ClipOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
clip_grad
,
ops
::
ClipOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
clip
,
ops
::
ClipKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
clip
,
ops
::
ClipKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/concat_op.cc
浏览文件 @
d84cdb7b
...
@@ -103,8 +103,10 @@ class ConcatOpGrad : public framework::OperatorWithKernel {
...
@@ -103,8 +103,10 @@ class ConcatOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_EX
(
concat
,
ops
::
ConcatOp
,
ops
::
ConcatOpMaker
,
concat_grad
,
REGISTER_OPERATOR
(
concat
,
ops
::
ConcatOp
,
ops
::
ConcatOpMaker
,
ops
::
ConcatOpGrad
,
false
)
paddle
::
framework
::
DefaultGradOpDescMaker
<
false
>
/* set false to disable empty grad */
)
REGISTER_OPERATOR
(
concat_grad
,
ops
::
ConcatOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
concat
,
ops
::
ConcatKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
)
concat
,
ops
::
ConcatKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/conv_op.cc
浏览文件 @
d84cdb7b
...
@@ -335,14 +335,17 @@ framework::OpKernelType ConvOpGrad::GetExpectedKernelType(
...
@@ -335,14 +335,17 @@ framework::OpKernelType ConvOpGrad::GetExpectedKernelType(
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
conv2d
,
ops
::
ConvOp
,
ops
::
Conv2DOpMaker
,
conv2d_grad
,
REGISTER_OPERATOR
(
conv2d
,
ops
::
ConvOp
,
ops
::
Conv2DOpMaker
,
ops
::
ConvOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
conv2d_grad
,
ops
::
ConvOpGrad
)
// depthwise convolution op
// depthwise convolution op
REGISTER_OP
(
depthwise_conv2d
,
ops
::
ConvOp
,
ops
::
Conv2DOpMaker
,
REGISTER_OPERATOR
(
depthwise_conv2d
,
ops
::
ConvOp
,
ops
::
Conv2DOpMaker
,
depthwise_conv2d_grad
,
ops
::
ConvOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OP
(
conv3d
,
ops
::
ConvOp
,
ops
::
Conv3DOpMaker
,
conv3d_grad
,
REGISTER_OPERATOR
(
depthwise_conv2d_grad
,
ops
::
ConvOpGrad
)
ops
::
ConvOpGrad
);
REGISTER_OPERATOR
(
conv3d
,
ops
::
ConvOp
,
ops
::
Conv3DOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
conv3d_grad
,
ops
::
ConvOpGrad
)
// depthwise conv kernel
// depthwise conv kernel
// TODO(xingzhaolong): neon kernel for mobile
// TODO(xingzhaolong): neon kernel for mobile
...
...
paddle/fluid/operators/conv_shift_op.cc
浏览文件 @
d84cdb7b
...
@@ -193,8 +193,9 @@ class ConvShiftGradKernel<platform::CPUPlace, T>
...
@@ -193,8 +193,9 @@ class ConvShiftGradKernel<platform::CPUPlace, T>
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
conv_shift
,
ops
::
ConvShiftOp
,
ops
::
ConvShiftOpMaker
,
REGISTER_OPERATOR
(
conv_shift
,
ops
::
ConvShiftOp
,
ops
::
ConvShiftOpMaker
,
conv_shift_grad
,
ops
::
ConvShiftGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
conv_shift_grad
,
ops
::
ConvShiftGradOp
)
REGISTER_OP_CPU_KERNEL
(
conv_shift
,
REGISTER_OP_CPU_KERNEL
(
conv_shift
,
ops
::
ConvShiftKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
ops
::
ConvShiftKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/conv_transpose_op.cc
浏览文件 @
d84cdb7b
...
@@ -298,8 +298,10 @@ framework::OpKernelType ConvTransposeOpGrad::GetExpectedKernelType(
...
@@ -298,8 +298,10 @@ framework::OpKernelType ConvTransposeOpGrad::GetExpectedKernelType(
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
conv2d_transpose
,
ops
::
ConvTransposeOp
,
ops
::
Conv2DTransposeOpMaker
,
REGISTER_OPERATOR
(
conv2d_transpose
,
ops
::
ConvTransposeOp
,
conv2d_transpose_grad
,
ops
::
ConvTransposeOpGrad
);
ops
::
Conv2DTransposeOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
conv2d_transpose_grad
,
ops
::
ConvTransposeOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
conv2d_transpose
,
conv2d_transpose
,
...
@@ -311,8 +313,10 @@ REGISTER_OP_CPU_KERNEL(
...
@@ -311,8 +313,10 @@ REGISTER_OP_CPU_KERNEL(
ops
::
GemmConvTransposeGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
ops
::
GemmConvTransposeGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
double
>
);
REGISTER_OP
(
conv3d_transpose
,
ops
::
ConvTransposeOp
,
ops
::
Conv3DTransposeOpMaker
,
REGISTER_OPERATOR
(
conv3d_transpose
,
ops
::
ConvTransposeOp
,
conv3d_transpose_grad
,
ops
::
ConvTransposeOpGrad
);
ops
::
Conv3DTransposeOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
conv3d_transpose_grad
,
ops
::
ConvTransposeOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
conv3d_transpose
,
conv3d_transpose
,
...
...
paddle/fluid/operators/cos_sim_op.cc
浏览文件 @
d84cdb7b
...
@@ -153,8 +153,9 @@ class CosSimOpGrad : public framework::OperatorWithKernel {
...
@@ -153,8 +153,9 @@ class CosSimOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
cos_sim
,
ops
::
CosSimOp
,
ops
::
CosSimOpMaker
,
cos_sim_grad
,
REGISTER_OPERATOR
(
cos_sim
,
ops
::
CosSimOp
,
ops
::
CosSimOpMaker
,
ops
::
CosSimOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
cos_sim_grad
,
ops
::
CosSimOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
cos_sim
,
ops
::
CosSimKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
cos_sim
,
ops
::
CosSimKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/crop_op.cc
浏览文件 @
d84cdb7b
...
@@ -153,7 +153,9 @@ class CropOpGrad : public framework::OperatorWithKernel {
...
@@ -153,7 +153,9 @@ class CropOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
crop
,
ops
::
CropOp
,
ops
::
CropOpMaker
,
crop_grad
,
ops
::
CropOpGrad
);
REGISTER_OPERATOR
(
crop
,
ops
::
CropOp
,
ops
::
CropOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
);
REGISTER_OPERATOR
(
crop_grad
,
ops
::
CropOpGrad
);
REGISTER_OP_CPU_KERNEL
(
crop
,
ops
::
CropKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
crop
,
ops
::
CropKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
crop_grad
,
ops
::
CropGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
crop_grad
,
ops
::
CropGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
paddle/fluid/operators/cross_entropy_op.cc
浏览文件 @
d84cdb7b
...
@@ -164,8 +164,9 @@ or not. But the output only shares the LoD information with input X.
...
@@ -164,8 +164,9 @@ or not. But the output only shares the LoD information with input X.
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
cross_entropy
,
ops
::
CrossEntropyOp
,
ops
::
CrossEntropyOpMaker
,
REGISTER_OPERATOR
(
cross_entropy
,
ops
::
CrossEntropyOp
,
ops
::
CrossEntropyOpMaker
,
cross_entropy_grad
,
ops
::
CrossEntropyGradientOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
cross_entropy_grad
,
ops
::
CrossEntropyGradientOp
)
REGISTER_OP_CPU_KERNEL
(
cross_entropy
,
ops
::
CrossEntropyOpKernel
<
float
>
,
REGISTER_OP_CPU_KERNEL
(
cross_entropy
,
ops
::
CrossEntropyOpKernel
<
float
>
,
ops
::
CrossEntropyOpKernel
<
double
>
);
ops
::
CrossEntropyOpKernel
<
double
>
);
REGISTER_OP_CPU_KERNEL
(
cross_entropy_grad
,
REGISTER_OP_CPU_KERNEL
(
cross_entropy_grad
,
...
...
paddle/fluid/operators/dropout_op.cc
浏览文件 @
d84cdb7b
...
@@ -101,8 +101,9 @@ class DropoutOpGrad : public framework::OperatorWithKernel {
...
@@ -101,8 +101,9 @@ class DropoutOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
dropout
,
ops
::
DropoutOp
,
ops
::
DropoutOpMaker
,
dropout_grad
,
REGISTER_OPERATOR
(
dropout
,
ops
::
DropoutOp
,
ops
::
DropoutOpMaker
,
ops
::
DropoutOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
dropout_grad
,
ops
::
DropoutOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
dropout
,
ops
::
CPUDropoutKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
dropout
,
ops
::
CPUDropoutKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/elementwise_div_op.cc
浏览文件 @
d84cdb7b
...
@@ -30,8 +30,10 @@ class ElementwiseDivOpMaker : public ElementwiseOpMaker {
...
@@ -30,8 +30,10 @@ class ElementwiseDivOpMaker : public ElementwiseOpMaker {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
elementwise_div
,
ops
::
ElementwiseOp
,
ops
::
ElementwiseDivOpMaker
,
REGISTER_OPERATOR
(
elementwise_div
,
ops
::
ElementwiseOp
,
elementwise_div_grad
,
ops
::
ElementwiseOpGrad
);
ops
::
ElementwiseDivOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elementwise_div_grad
,
ops
::
ElementwiseOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
elementwise_div
,
elementwise_div
,
ops
::
ElementwiseDivKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ElementwiseDivKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/elementwise_max_op.cc
浏览文件 @
d84cdb7b
...
@@ -29,8 +29,10 @@ class ElementwiseMaxOpMaker : public ElementwiseOpMaker {
...
@@ -29,8 +29,10 @@ class ElementwiseMaxOpMaker : public ElementwiseOpMaker {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
elementwise_max
,
ops
::
ElementwiseOp
,
ops
::
ElementwiseMaxOpMaker
,
REGISTER_OPERATOR
(
elementwise_max
,
ops
::
ElementwiseOp
,
elementwise_max_grad
,
ops
::
ElementwiseOpGrad
);
ops
::
ElementwiseMaxOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elementwise_max_grad
,
ops
::
ElementwiseOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
elementwise_max
,
elementwise_max
,
ops
::
ElementwiseMaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ElementwiseMaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/elementwise_min_op.cc
浏览文件 @
d84cdb7b
...
@@ -29,8 +29,10 @@ class ElementwiseMinOpMaker : public ElementwiseOpMaker {
...
@@ -29,8 +29,10 @@ class ElementwiseMinOpMaker : public ElementwiseOpMaker {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
elementwise_min
,
ops
::
ElementwiseOp
,
ops
::
ElementwiseMinOpMaker
,
REGISTER_OPERATOR
(
elementwise_min
,
ops
::
ElementwiseOp
,
elementwise_min_grad
,
ops
::
ElementwiseOpGrad
);
ops
::
ElementwiseMinOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elementwise_min_grad
,
ops
::
ElementwiseOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
elementwise_min
,
elementwise_min
,
ops
::
ElementwiseMinKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ElementwiseMinKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/elementwise_mul_op.cc
浏览文件 @
d84cdb7b
...
@@ -31,8 +31,10 @@ class ElementwiseMulOpMaker : public ElementwiseOpMaker {
...
@@ -31,8 +31,10 @@ class ElementwiseMulOpMaker : public ElementwiseOpMaker {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
elementwise_mul
,
ops
::
ElementwiseOp
,
ops
::
ElementwiseMulOpMaker
,
REGISTER_OPERATOR
(
elementwise_mul
,
ops
::
ElementwiseOp
,
elementwise_mul_grad
,
ops
::
ElementwiseOpGrad
);
ops
::
ElementwiseMulOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elementwise_mul_grad
,
ops
::
ElementwiseOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
elementwise_mul
,
elementwise_mul
,
ops
::
ElementwiseMulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ElementwiseMulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/elementwise_sub_op.cc
浏览文件 @
d84cdb7b
...
@@ -29,8 +29,10 @@ class ElementwiseSubOpMaker : public ElementwiseOpMaker {
...
@@ -29,8 +29,10 @@ class ElementwiseSubOpMaker : public ElementwiseOpMaker {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
elementwise_sub
,
ops
::
ElementwiseOp
,
ops
::
ElementwiseSubOpMaker
,
REGISTER_OPERATOR
(
elementwise_sub
,
ops
::
ElementwiseOp
,
elementwise_sub_grad
,
ops
::
ElementwiseOpGrad
);
ops
::
ElementwiseSubOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
elementwise_sub_grad
,
ops
::
ElementwiseOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
elementwise_sub
,
elementwise_sub
,
ops
::
ElementwiseSubKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
ElementwiseSubKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/expand_op.cc
浏览文件 @
d84cdb7b
...
@@ -14,6 +14,8 @@ limitations under the License. */
...
@@ -14,6 +14,8 @@ limitations under the License. */
#include "paddle/fluid/operators/expand_op.h"
#include "paddle/fluid/operators/expand_op.h"
#include <vector>
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -128,8 +130,9 @@ class ExpandGradOp : public framework::OperatorWithKernel {
...
@@ -128,8 +130,9 @@ class ExpandGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
expand
,
ops
::
ExpandOp
,
ops
::
ExpandOpMaker
,
expand_grad
,
REGISTER_OPERATOR
(
expand
,
ops
::
ExpandOp
,
ops
::
ExpandOpMaker
,
ops
::
ExpandGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
expand_grad
,
ops
::
ExpandGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
expand
,
ops
::
ExpandKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
expand
,
ops
::
ExpandKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/fc_op.cc
浏览文件 @
d84cdb7b
...
@@ -98,5 +98,6 @@ FCOpMaker::FCOpMaker(OpProto* proto, OpAttrChecker* op_checker)
...
@@ -98,5 +98,6 @@ FCOpMaker::FCOpMaker(OpProto* proto, OpAttrChecker* op_checker)
}
// namespace operators
}
// namespace operators
}
// namespace paddle
}
// namespace paddle
REGISTER_OP
(
fc
,
paddle
::
operators
::
FCOp
,
paddle
::
operators
::
FCOpMaker
,
fc_grad
,
REGISTER_OPERATOR
(
fc
,
paddle
::
operators
::
FCOp
,
paddle
::
operators
::
FCOpMaker
,
paddle
::
operators
::
FCOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
fc_grad
,
paddle
::
operators
::
FCOpGrad
)
paddle/fluid/operators/gather_op.cc
浏览文件 @
d84cdb7b
...
@@ -100,7 +100,8 @@ Out = [[3, 4],
...
@@ -100,7 +100,8 @@ Out = [[3, 4],
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
gather
,
ops
::
GatherOp
,
ops
::
GatherOpMaker
,
gather_grad
,
REGISTER_OPERATOR
(
gather
,
ops
::
GatherOp
,
ops
::
GatherOpMaker
,
ops
::
GatherGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
gather_grad
,
ops
::
GatherGradOp
)
REGISTER_OP_CPU_KERNEL
(
gather
,
ops
::
GatherOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
gather
,
ops
::
GatherOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
gather_grad
,
ops
::
GatherGradientOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
gather_grad
,
ops
::
GatherGradientOpKernel
<
float
>
);
paddle/fluid/operators/gru_op.cc
浏览文件 @
d84cdb7b
...
@@ -216,7 +216,9 @@ class GRUGradOp : public framework::OperatorWithKernel {
...
@@ -216,7 +216,9 @@ class GRUGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
gru
,
ops
::
GRUOp
,
ops
::
GRUOpMaker
,
gru_grad
,
ops
::
GRUGradOp
);
REGISTER_OPERATOR
(
gru
,
ops
::
GRUOp
,
ops
::
GRUOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
gru_grad
,
ops
::
GRUGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
gru
,
ops
::
GRUKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
gru
,
ops
::
GRUKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
GRUKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
GRUKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/gru_unit_op.cc
浏览文件 @
d84cdb7b
...
@@ -198,8 +198,9 @@ class GRUUnitGradOp : public framework::OperatorWithKernel {
...
@@ -198,8 +198,9 @@ class GRUUnitGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
gru_unit
,
ops
::
GRUUnitOp
,
ops
::
GRUUnitOpMaker
,
gru_unit_grad
,
REGISTER_OPERATOR
(
gru_unit
,
ops
::
GRUUnitOp
,
ops
::
GRUUnitOpMaker
,
ops
::
GRUUnitGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
gru_unit_grad
,
ops
::
GRUUnitGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
gru_unit
,
ops
::
GRUUnitKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
gru_unit
,
ops
::
GRUUnitKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
GRUUnitKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
GRUUnitKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/hinge_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -103,8 +103,9 @@ class HingeLossGradOp : public framework::OperatorWithKernel {
...
@@ -103,8 +103,9 @@ class HingeLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
hinge_loss
,
ops
::
HingeLossOp
,
ops
::
HingeLossOpMaker
<
float
>
,
REGISTER_OPERATOR
(
hinge_loss
,
ops
::
HingeLossOp
,
ops
::
HingeLossOpMaker
<
float
>
,
hinge_loss_grad
,
ops
::
HingeLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
hinge_loss_grad
,
ops
::
HingeLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
hinge_loss
,
hinge_loss
,
ops
::
HingeLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
HingeLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/huber_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -121,8 +121,9 @@ class HuberLossGradOp : public framework::OperatorWithKernel {
...
@@ -121,8 +121,9 @@ class HuberLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
huber_loss
,
ops
::
HuberLossOp
,
ops
::
HuberLossOpMaker
<
float
>
,
REGISTER_OPERATOR
(
huber_loss
,
ops
::
HuberLossOp
,
ops
::
HuberLossOpMaker
<
float
>
,
huber_loss_grad
,
ops
::
HuberLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
huber_loss_grad
,
ops
::
HuberLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
huber_loss
,
huber_loss
,
ops
::
HuberLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
HuberLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/im2sequence_op.cc
浏览文件 @
d84cdb7b
...
@@ -148,8 +148,9 @@ class Im2SequenceGradOp : public framework::OperatorWithKernel {
...
@@ -148,8 +148,9 @@ class Im2SequenceGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
im2sequence
,
ops
::
Im2SequenceOp
,
ops
::
Im2SequenceOpMaker
,
REGISTER_OPERATOR
(
im2sequence
,
ops
::
Im2SequenceOp
,
ops
::
Im2SequenceOpMaker
,
im2sequence_grad
,
ops
::
Im2SequenceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
im2sequence_grad
,
ops
::
Im2SequenceGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
im2sequence
,
im2sequence
,
ops
::
Im2SequenceKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
Im2SequenceKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/l1_norm_op.cc
浏览文件 @
d84cdb7b
...
@@ -67,8 +67,9 @@ $$Out = \sum{|X|}$$
...
@@ -67,8 +67,9 @@ $$Out = \sum{|X|}$$
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
l1_norm
,
ops
::
L1NormOp
,
ops
::
L1NormOpMaker
,
l1_norm_grad
,
REGISTER_OPERATOR
(
l1_norm
,
ops
::
L1NormOp
,
ops
::
L1NormOpMaker
,
ops
::
L1NormGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
l1_norm_grad
,
ops
::
L1NormGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
l1_norm
,
ops
::
L1NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
l1_norm
,
ops
::
L1NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/label_smooth_op.cc
浏览文件 @
d84cdb7b
...
@@ -117,8 +117,9 @@ class LabelSmoothGradOp : public framework::OperatorWithKernel {
...
@@ -117,8 +117,9 @@ class LabelSmoothGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
label_smooth
,
ops
::
LabelSmoothOp
,
ops
::
LabelSmoothOpMaker
,
REGISTER_OPERATOR
(
label_smooth
,
ops
::
LabelSmoothOp
,
ops
::
LabelSmoothOpMaker
,
label_smooth_grad
,
ops
::
LabelSmoothGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
label_smooth_grad
,
ops
::
LabelSmoothGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
label_smooth
,
label_smooth
,
ops
::
LabelSmoothKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
LabelSmoothKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/layer_norm_op.cc
浏览文件 @
d84cdb7b
...
@@ -162,8 +162,9 @@ class LayerNormGradOp : public framework::OperatorWithKernel {
...
@@ -162,8 +162,9 @@ class LayerNormGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
layer_norm
,
ops
::
LayerNormOp
,
ops
::
LayerNormOpMaker
,
REGISTER_OPERATOR
(
layer_norm
,
ops
::
LayerNormOp
,
ops
::
LayerNormOpMaker
,
layer_norm_grad
,
ops
::
LayerNormGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
layer_norm_grad
,
ops
::
LayerNormGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
layer_norm
,
ops
::
LayerNormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
layer_norm
,
ops
::
LayerNormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
LayerNormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
LayerNormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/linear_chain_crf_op.cc
浏览文件 @
d84cdb7b
...
@@ -256,8 +256,10 @@ class LinearChainCRFGradOp : public framework::OperatorWithKernel {
...
@@ -256,8 +256,10 @@ class LinearChainCRFGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
linear_chain_crf
,
ops
::
LinearChainCRFOp
,
ops
::
LinearChainCRFOpMaker
,
REGISTER_OPERATOR
(
linear_chain_crf
,
ops
::
LinearChainCRFOp
,
linear_chain_crf_grad
,
ops
::
LinearChainCRFGradOp
);
ops
::
LinearChainCRFOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
linear_chain_crf_grad
,
ops
::
LinearChainCRFGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
linear_chain_crf
,
linear_chain_crf
,
ops
::
LinearChainCRFOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
LinearChainCRFOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/lod_reset_op.cc
浏览文件 @
d84cdb7b
...
@@ -155,8 +155,9 @@ class LoDResetGradOp : public framework::OperatorWithKernel {
...
@@ -155,8 +155,9 @@ class LoDResetGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
lod_reset
,
ops
::
LoDResetOp
,
ops
::
LoDResetOpMaker
,
lod_reset_grad
,
REGISTER_OPERATOR
(
lod_reset
,
ops
::
LoDResetOp
,
ops
::
LoDResetOpMaker
,
ops
::
LoDResetGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
lod_reset_grad
,
ops
::
LoDResetGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
lod_reset
,
ops
::
LoDResetKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
lod_reset
,
ops
::
LoDResetKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
ops
::
LoDResetKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
,
ops
::
LoDResetKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
,
...
...
paddle/fluid/operators/log_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -106,8 +106,9 @@ class LogLossGradOp : public framework::OperatorWithKernel {
...
@@ -106,8 +106,9 @@ class LogLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
log_loss
,
ops
::
LogLossOp
,
ops
::
LogLossOpMaker
<
float
>
,
log_loss_grad
,
REGISTER_OPERATOR
(
log_loss
,
ops
::
LogLossOp
,
ops
::
LogLossOpMaker
<
float
>
,
ops
::
LogLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
log_loss_grad
,
ops
::
LogLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
log_loss
,
ops
::
LogLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
log_loss
,
ops
::
LogLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/lrn_op.cc
浏览文件 @
d84cdb7b
...
@@ -276,7 +276,9 @@ class LRNOpGrad : public framework::OperatorWithKernel {
...
@@ -276,7 +276,9 @@ class LRNOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
lrn
,
ops
::
LRNOp
,
ops
::
LRNOpMaker
<
float
>
,
lrn_grad
,
ops
::
LRNOpGrad
);
REGISTER_OPERATOR
(
lrn
,
ops
::
LRNOp
,
ops
::
LRNOpMaker
<
float
>
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
lrn_grad
,
ops
::
LRNOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
lrn
,
ops
::
LRNKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
lrn
,
ops
::
LRNKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/lstm_op.cc
浏览文件 @
d84cdb7b
...
@@ -273,7 +273,9 @@ class LSTMGradOp : public framework::OperatorWithKernel {
...
@@ -273,7 +273,9 @@ class LSTMGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
lstm
,
ops
::
LSTMOp
,
ops
::
LSTMOpMaker
,
lstm_grad
,
ops
::
LSTMGradOp
);
REGISTER_OPERATOR
(
lstm
,
ops
::
LSTMOp
,
ops
::
LSTMOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
lstm_grad
,
ops
::
LSTMGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
lstm
,
ops
::
LSTMKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
lstm
,
ops
::
LSTMKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
LSTMKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
LSTMKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/lstm_unit_op.cc
浏览文件 @
d84cdb7b
...
@@ -97,8 +97,9 @@ class LstmUnitGradOp : public framework::OperatorWithKernel {
...
@@ -97,8 +97,9 @@ class LstmUnitGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
lstm_unit
,
ops
::
LstmUnitOp
,
ops
::
LstmUnitOpMaker
,
lstm_unit_grad
,
REGISTER_OPERATOR
(
lstm_unit
,
ops
::
LstmUnitOp
,
ops
::
LstmUnitOpMaker
,
ops
::
LstmUnitGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
lstm_unit_grad
,
ops
::
LstmUnitGradOp
)
REGISTER_OP_CPU_KERNEL
(
lstm_unit
,
REGISTER_OP_CPU_KERNEL
(
lstm_unit
,
ops
::
LstmUnitKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
ops
::
LstmUnitKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
ops
::
LstmUnitKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
);
ops
::
LstmUnitKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
);
...
...
paddle/fluid/operators/lstmp_op.cc
浏览文件 @
d84cdb7b
...
@@ -322,8 +322,9 @@ class LSTMPGradOp : public framework::OperatorWithKernel {
...
@@ -322,8 +322,9 @@ class LSTMPGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
lstmp
,
ops
::
LSTMPOp
,
ops
::
LSTMPOpMaker
,
lstmp_grad
,
REGISTER_OPERATOR
(
lstmp
,
ops
::
LSTMPOp
,
ops
::
LSTMPOpMaker
,
ops
::
LSTMPGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
lstmp_grad
,
ops
::
LSTMPGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
lstmp
,
ops
::
LSTMPKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
lstmp
,
ops
::
LSTMPKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
LSTMPKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
LSTMPKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/margin_rank_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -111,9 +111,10 @@ class MarginRankLossGradOp : public framework::OperatorWithKernel {
...
@@ -111,9 +111,10 @@ class MarginRankLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
margin_rank_loss
,
ops
::
MarginRankLossOp
,
REGISTER_OPERATOR
(
margin_rank_loss
,
ops
::
MarginRankLossOp
,
ops
::
MarginRankLossOpMaker
<
float
>
,
margin_rank_loss_grad
,
ops
::
MarginRankLossOpMaker
<
float
>
,
ops
::
MarginRankLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
margin_rank_loss_grad
,
ops
::
MarginRankLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
margin_rank_loss
,
margin_rank_loss
,
ops
::
MarginRankLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
MarginRankLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/matmul_op.cc
浏览文件 @
d84cdb7b
...
@@ -237,8 +237,9 @@ class MatMulOpGrad : public framework::OperatorWithKernel {
...
@@ -237,8 +237,9 @@ class MatMulOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
matmul
,
ops
::
MatMulOp
,
ops
::
MatMulOpMaker
,
matmul_grad
,
REGISTER_OPERATOR
(
matmul
,
ops
::
MatMulOp
,
ops
::
MatMulOpMaker
,
ops
::
MatMulOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
matmul_grad
,
ops
::
MatMulOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
matmul
,
ops
::
MatMulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
matmul
,
ops
::
MatMulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/maxout_op.cc
浏览文件 @
d84cdb7b
...
@@ -101,8 +101,9 @@ class MaxOutOpGrad : public framework::OperatorWithKernel {
...
@@ -101,8 +101,9 @@ class MaxOutOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
maxout
,
ops
::
MaxOutOp
,
ops
::
MaxOutOpMaker
,
maxout_grad
,
REGISTER_OPERATOR
(
maxout
,
ops
::
MaxOutOp
,
ops
::
MaxOutOpMaker
,
ops
::
MaxOutOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
maxout_grad
,
ops
::
MaxOutOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
maxout
,
ops
::
MaxOutKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
maxout
,
ops
::
MaxOutKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/modified_huber_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -108,9 +108,10 @@ class ModifiedHuberLossGradOp : public framework::OperatorWithKernel {
...
@@ -108,9 +108,10 @@ class ModifiedHuberLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
modified_huber_loss
,
ops
::
ModifiedHuberLossOp
,
REGISTER_OPERATOR
(
modified_huber_loss
,
ops
::
ModifiedHuberLossOp
,
ops
::
ModifiedHuberLossOpMaker
,
modified_huber_loss_grad
,
ops
::
ModifiedHuberLossOpMaker
,
ops
::
ModifiedHuberLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
modified_huber_loss_grad
,
ops
::
ModifiedHuberLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
modified_huber_loss
,
modified_huber_loss
,
...
...
paddle/fluid/operators/mul_op.cc
浏览文件 @
d84cdb7b
...
@@ -160,7 +160,9 @@ class MulGradOp : public framework::OperatorWithKernel {
...
@@ -160,7 +160,9 @@ class MulGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
mul
,
ops
::
MulOp
,
ops
::
MulOpMaker
,
mul_grad
,
ops
::
MulGradOp
);
REGISTER_OPERATOR
(
mul
,
ops
::
MulOp
,
ops
::
MulOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
mul_grad
,
ops
::
MulGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
mul
,
ops
::
MulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
mul
,
ops
::
MulKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/nce_op.cc
浏览文件 @
d84cdb7b
...
@@ -14,6 +14,8 @@ limitations under the License. */
...
@@ -14,6 +14,8 @@ limitations under the License. */
#include "paddle/fluid/operators/nce_op.h"
#include "paddle/fluid/operators/nce_op.h"
#include <vector>
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -179,7 +181,9 @@ class NCEOpGrad : public framework::OperatorWithKernel {
...
@@ -179,7 +181,9 @@ class NCEOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
nce
,
ops
::
NCEOp
,
ops
::
NCEOpMaker
,
nce_grad
,
ops
::
NCEOpGrad
);
REGISTER_OPERATOR
(
nce
,
ops
::
NCEOp
,
ops
::
NCEOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
nce_grad
,
ops
::
NCEOpGrad
)
REGISTER_OP_CPU_KERNEL
(
nce
,
ops
::
NCEKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
REGISTER_OP_CPU_KERNEL
(
nce
,
ops
::
NCEKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
ops
::
NCEKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
);
ops
::
NCEKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
);
REGISTER_OP_CPU_KERNEL
(
nce_grad
,
REGISTER_OP_CPU_KERNEL
(
nce_grad
,
...
...
paddle/fluid/operators/norm_op.cc
浏览文件 @
d84cdb7b
...
@@ -85,8 +85,9 @@ class NormOpGrad : public framework::OperatorWithKernel {
...
@@ -85,8 +85,9 @@ class NormOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
norm
,
ops
::
NormOp
,
ops
::
NormOpMaker
<
float
>
,
norm_grad
,
REGISTER_OPERATOR
(
norm
,
ops
::
NormOp
,
ops
::
NormOpMaker
<
float
>
,
ops
::
NormOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
norm_grad
,
ops
::
NormOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
norm
,
ops
::
NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
norm
,
ops
::
NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
,
float
>
);
ops
::
NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
,
float
>
);
...
...
paddle/fluid/operators/pool_op.cc
浏览文件 @
d84cdb7b
...
@@ -333,8 +333,9 @@ Example:
...
@@ -333,8 +333,9 @@ Example:
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
pool2d
,
ops
::
PoolOp
,
ops
::
Pool2dOpMaker
,
pool2d_grad
,
REGISTER_OPERATOR
(
pool2d
,
ops
::
PoolOp
,
ops
::
Pool2dOpMaker
,
ops
::
PoolOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
pool2d_grad
,
ops
::
PoolOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
pool2d
,
ops
::
PoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
pool2d
,
ops
::
PoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
@@ -343,8 +344,9 @@ REGISTER_OP_CPU_KERNEL(
...
@@ -343,8 +344,9 @@ REGISTER_OP_CPU_KERNEL(
pool2d_grad
,
ops
::
PoolGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
pool2d_grad
,
ops
::
PoolGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
PoolGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
)
ops
::
PoolGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
)
REGISTER_OP
(
pool3d
,
ops
::
PoolOp
,
ops
::
Pool3dOpMaker
,
pool3d_grad
,
REGISTER_OPERATOR
(
pool3d
,
ops
::
PoolOp
,
ops
::
Pool3dOpMaker
,
ops
::
PoolOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
pool3d_grad
,
ops
::
PoolOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
pool3d
,
ops
::
PoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
pool3d
,
ops
::
PoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/pool_with_index_op.cc
浏览文件 @
d84cdb7b
...
@@ -258,9 +258,10 @@ Example:
...
@@ -258,9 +258,10 @@ Example:
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
max_pool2d_with_index
,
ops
::
MaxPoolWithIndexOp
,
REGISTER_OPERATOR
(
max_pool2d_with_index
,
ops
::
MaxPoolWithIndexOp
,
ops
::
MaxPool2dWithIndexOpMaker
,
max_pool2d_with_index_grad
,
ops
::
MaxPool2dWithIndexOpMaker
,
ops
::
MaxPoolWithIndexOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
max_pool2d_with_index_grad
,
ops
::
MaxPoolWithIndexOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
max_pool2d_with_index
,
max_pool2d_with_index
,
...
@@ -274,9 +275,10 @@ REGISTER_OP_CPU_KERNEL(
...
@@ -274,9 +275,10 @@ REGISTER_OP_CPU_KERNEL(
ops
::
MaxPoolWithIndexGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
,
ops
::
MaxPoolWithIndexGradKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
,
int
>
)
int
>
)
REGISTER_OP
(
max_pool3d_with_index
,
ops
::
MaxPoolWithIndexOp
,
REGISTER_OPERATOR
(
max_pool3d_with_index
,
ops
::
MaxPoolWithIndexOp
,
ops
::
MaxPool3dWithIndexOpMaker
,
max_pool3d_with_index_grad
,
ops
::
MaxPool3dWithIndexOpMaker
,
ops
::
MaxPoolWithIndexOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
max_pool3d_with_index_grad
,
ops
::
MaxPoolWithIndexOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
max_pool3d_with_index
,
max_pool3d_with_index
,
...
...
paddle/fluid/operators/prelu_op.cc
浏览文件 @
d84cdb7b
...
@@ -83,8 +83,9 @@ class PReluGradOp : public framework::OperatorWithKernel {
...
@@ -83,8 +83,9 @@ class PReluGradOp : public framework::OperatorWithKernel {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
prelu
,
ops
::
PReluOp
,
ops
::
PReluOpMaker
,
prelu_grad
,
REGISTER_OPERATOR
(
prelu
,
ops
::
PReluOp
,
ops
::
PReluOpMaker
,
ops
::
PReluGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
prelu_grad
,
ops
::
PReluGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
prelu
,
ops
::
PReluKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
prelu
,
ops
::
PReluKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/rank_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -121,8 +121,9 @@ class RankLossGradOp : public framework::OperatorWithKernel {
...
@@ -121,8 +121,9 @@ class RankLossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
rank_loss
,
ops
::
RankLossOp
,
ops
::
RankLossOpMaker
,
rank_loss_grad
,
REGISTER_OPERATOR
(
rank_loss
,
ops
::
RankLossOp
,
ops
::
RankLossOpMaker
,
ops
::
RankLossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
rank_loss_grad
,
ops
::
RankLossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
rank_loss
,
ops
::
RankLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
rank_loss
,
ops
::
RankLossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/reduce_op.cc
浏览文件 @
d84cdb7b
...
@@ -14,6 +14,9 @@ limitations under the License. */
...
@@ -14,6 +14,9 @@ limitations under the License. */
#include "paddle/fluid/operators/reduce_op.h"
#include "paddle/fluid/operators/reduce_op.h"
#include <string>
#include <vector>
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -122,18 +125,18 @@ If reduce_all is true, just reduce along all dimensions and output a scalar.
...
@@ -122,18 +125,18 @@ If reduce_all is true, just reduce along all dimensions and output a scalar.
protected:
protected:
std
::
string
comment_
;
std
::
string
comment_
;
void
Replace
(
std
::
string
&
src
,
std
::
string
from
,
std
::
string
to
)
{
void
Replace
(
std
::
string
*
src
,
std
::
string
from
,
std
::
string
to
)
{
std
::
size_t
len_from
=
std
::
strlen
(
from
.
c_str
());
std
::
size_t
len_from
=
std
::
strlen
(
from
.
c_str
());
std
::
size_t
len_to
=
std
::
strlen
(
to
.
c_str
());
std
::
size_t
len_to
=
std
::
strlen
(
to
.
c_str
());
for
(
std
::
size_t
pos
=
src
.
find
(
from
);
pos
!=
std
::
string
::
npos
;
for
(
std
::
size_t
pos
=
src
->
find
(
from
);
pos
!=
std
::
string
::
npos
;
pos
=
src
.
find
(
from
,
pos
+
len_to
))
{
pos
=
src
->
find
(
from
,
pos
+
len_to
))
{
src
.
replace
(
pos
,
len_from
,
to
);
src
->
replace
(
pos
,
len_from
,
to
);
}
}
}
}
void
SetComment
(
std
::
string
name
,
std
::
string
op
)
{
void
SetComment
(
std
::
string
name
,
std
::
string
op
)
{
Replace
(
comment_
,
"{ReduceOp}"
,
name
);
Replace
(
&
comment_
,
"{ReduceOp}"
,
name
);
Replace
(
comment_
,
"{reduce}"
,
op
);
Replace
(
&
comment_
,
"{reduce}"
,
op
);
}
}
};
};
...
@@ -187,20 +190,25 @@ class ReduceProdOpMaker : public ReduceOpMaker {
...
@@ -187,20 +190,25 @@ class ReduceProdOpMaker : public ReduceOpMaker {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
reduce_sum
,
ops
::
ReduceOp
,
ops
::
ReduceSumOpMaker
,
reduce_sum_grad
,
REGISTER_OPERATOR
(
reduce_sum
,
ops
::
ReduceOp
,
ops
::
ReduceSumOpMaker
,
ops
::
ReduceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reduce_sum_grad
,
ops
::
ReduceGradOp
)
REGISTER_OP
(
reduce_mean
,
ops
::
ReduceOp
,
ops
::
ReduceMeanOpMaker
,
REGISTER_OPERATOR
(
reduce_mean
,
ops
::
ReduceOp
,
ops
::
ReduceMeanOpMaker
,
reduce_mean_grad
,
ops
::
ReduceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reduce_mean_grad
,
ops
::
ReduceGradOp
)
REGISTER_OP
(
reduce_max
,
ops
::
ReduceOp
,
ops
::
ReduceMaxOpMaker
,
reduce_max_grad
,
REGISTER_OPERATOR
(
reduce_max
,
ops
::
ReduceOp
,
ops
::
ReduceMaxOpMaker
,
ops
::
ReduceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reduce_max_grad
,
ops
::
ReduceGradOp
)
REGISTER_OP
(
reduce_min
,
ops
::
ReduceOp
,
ops
::
ReduceMinOpMaker
,
reduce_min_grad
,
REGISTER_OPERATOR
(
reduce_min
,
ops
::
ReduceOp
,
ops
::
ReduceMinOpMaker
,
ops
::
ReduceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reduce_min_grad
,
ops
::
ReduceGradOp
)
REGISTER_OP
(
reduce_prod
,
ops
::
ReduceOp
,
ops
::
ReduceProdOpMaker
,
REGISTER_OPERATOR
(
reduce_prod
,
ops
::
ReduceOp
,
ops
::
ReduceProdOpMaker
,
reduce_prod_grad
,
ops
::
ReduceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reduce_prod_grad
,
ops
::
ReduceGradOp
)
#define REGISTER_REDUCE_CPU_KERNEL(reduce_type, functor, grad_functor) \
#define REGISTER_REDUCE_CPU_KERNEL(reduce_type, functor, grad_functor) \
REGISTER_OP_CPU_KERNEL(reduce_type, \
REGISTER_OP_CPU_KERNEL(reduce_type, \
...
...
paddle/fluid/operators/reshape_op.cc
浏览文件 @
d84cdb7b
...
@@ -113,8 +113,9 @@ class ReshapeGradOp : public framework::OperatorWithKernel {
...
@@ -113,8 +113,9 @@ class ReshapeGradOp : public framework::OperatorWithKernel {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
using
CPU
=
paddle
::
platform
::
CPUDeviceContext
;
using
CPU
=
paddle
::
platform
::
CPUDeviceContext
;
REGISTER_OP
(
reshape
,
ops
::
ReshapeOp
,
ops
::
ReshapeOpMaker
,
reshape_grad
,
REGISTER_OPERATOR
(
reshape
,
ops
::
ReshapeOp
,
ops
::
ReshapeOpMaker
,
ops
::
ReshapeGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
reshape_grad
,
ops
::
ReshapeGradOp
)
REGISTER_OP_CPU_KERNEL
(
reshape
,
ops
::
ReshapeKernel
<
CPU
,
float
>
,
REGISTER_OP_CPU_KERNEL
(
reshape
,
ops
::
ReshapeKernel
<
CPU
,
float
>
,
ops
::
ReshapeKernel
<
CPU
,
double
>
,
ops
::
ReshapeKernel
<
CPU
,
double
>
,
ops
::
ReshapeKernel
<
CPU
,
int
>
,
ops
::
ReshapeKernel
<
CPU
,
int
>
,
...
...
paddle/fluid/operators/roi_pool_op.cc
浏览文件 @
d84cdb7b
...
@@ -153,8 +153,9 @@ https://stackoverflow.com/questions/43430056/what-is-roi-layer-in-fast-rcnn
...
@@ -153,8 +153,9 @@ https://stackoverflow.com/questions/43430056/what-is-roi-layer-in-fast-rcnn
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
roi_pool
,
ops
::
ROIPoolOp
,
ops
::
ROIPoolOpMaker
,
roi_pool_grad
,
REGISTER_OPERATOR
(
roi_pool
,
ops
::
ROIPoolOp
,
ops
::
ROIPoolOpMaker
,
ops
::
ROIPoolGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
roi_pool_grad
,
ops
::
ROIPoolGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
roi_pool
,
roi_pool
,
ops
::
CPUROIPoolOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
CPUROIPoolOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/row_conv_op.cc
浏览文件 @
d84cdb7b
...
@@ -250,8 +250,9 @@ class RowConvGradKernel<platform::CPUDeviceContext, T>
...
@@ -250,8 +250,9 @@ class RowConvGradKernel<platform::CPUDeviceContext, T>
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
row_conv
,
ops
::
RowConvOp
,
ops
::
RowConvOpMaker
,
row_conv_grad
,
REGISTER_OPERATOR
(
row_conv
,
ops
::
RowConvOp
,
ops
::
RowConvOpMaker
,
ops
::
RowConvGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
row_conv_grad
,
ops
::
RowConvGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
row_conv
,
ops
::
RowConvKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
row_conv
,
ops
::
RowConvKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/scatter_op.cc
浏览文件 @
d84cdb7b
...
@@ -102,7 +102,8 @@ $$
...
@@ -102,7 +102,8 @@ $$
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
scatter
,
ops
::
ScatterOp
,
ops
::
ScatterOpMaker
,
scatter_grad
,
REGISTER_OPERATOR
(
scatter
,
ops
::
ScatterOp
,
ops
::
ScatterOpMaker
,
ops
::
ScatterGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
scatter_grad
,
ops
::
ScatterGradOp
)
REGISTER_OP_CPU_KERNEL
(
scatter
,
ops
::
ScatterOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
scatter
,
ops
::
ScatterOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
scatter_grad
,
ops
::
ScatterGradientOpKernel
<
float
>
);
REGISTER_OP_CPU_KERNEL
(
scatter_grad
,
ops
::
ScatterGradientOpKernel
<
float
>
);
paddle/fluid/operators/sequence_concat_op.cc
浏览文件 @
d84cdb7b
...
@@ -124,9 +124,11 @@ class SequenceConcatGradOp : public framework::OperatorWithKernel {
...
@@ -124,9 +124,11 @@ class SequenceConcatGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_EX
(
sequence_concat
,
ops
::
SequenceConcatOp
,
REGISTER_OPERATOR
(
sequence_concat
,
ops
::
SequenceConcatOp
,
ops
::
SequenceConcatOpMaker
,
sequence_concat_grad
,
ops
::
SequenceConcatOpMaker
,
ops
::
SequenceConcatGradOp
,
false
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
false
>
/* set false to disable empty grad */
)
REGISTER_OPERATOR
(
sequence_concat_grad
,
ops
::
SequenceConcatGradOp
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
sequence_concat
,
sequence_concat
,
ops
::
SequenceConcatOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
SequenceConcatOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/sequence_conv_op.cc
浏览文件 @
d84cdb7b
...
@@ -14,6 +14,8 @@ limitations under the License. */
...
@@ -14,6 +14,8 @@ limitations under the License. */
#include "paddle/fluid/operators/sequence_conv_op.h"
#include "paddle/fluid/operators/sequence_conv_op.h"
#include <algorithm>
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -174,8 +176,9 @@ context_length, context_stride and context_start.
...
@@ -174,8 +176,9 @@ context_length, context_stride and context_start.
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sequence_conv
,
ops
::
SequenceConvOp
,
ops
::
SequenceConvOpMaker
,
REGISTER_OPERATOR
(
sequence_conv
,
ops
::
SequenceConvOp
,
ops
::
SequenceConvOpMaker
,
sequence_conv_grad
,
ops
::
SequenceConvGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sequence_conv_grad
,
ops
::
SequenceConvGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
sequence_conv
,
sequence_conv
,
...
...
paddle/fluid/operators/sequence_expand_op.cc
浏览文件 @
d84cdb7b
...
@@ -200,8 +200,10 @@ class SequenceExpandOpGrad : public framework::OperatorWithKernel {
...
@@ -200,8 +200,10 @@ class SequenceExpandOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sequence_expand
,
ops
::
SequenceExpandOp
,
ops
::
SequenceExpandOpMaker
,
REGISTER_OPERATOR
(
sequence_expand
,
ops
::
SequenceExpandOp
,
sequence_expand_grad
,
ops
::
SequenceExpandOpGrad
);
ops
::
SequenceExpandOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sequence_expand_grad
,
ops
::
SequenceExpandOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
sequence_expand
,
sequence_expand
,
ops
::
SequenceExpandKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
SequenceExpandKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/sequence_slice_op.cc
浏览文件 @
d84cdb7b
...
@@ -120,8 +120,10 @@ NOTE: The first dimension size of input, the size of offset and Length, should b
...
@@ -120,8 +120,10 @@ NOTE: The first dimension size of input, the size of offset and Length, should b
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sequence_slice
,
ops
::
SequenceSliceOp
,
ops
::
SequenceSliceOpMaker
,
REGISTER_OPERATOR
(
sequence_slice
,
ops
::
SequenceSliceOp
,
sequence_slice_grad
,
ops
::
SequenceSliceGradOp
);
ops
::
SequenceSliceOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sequence_slice_grad
,
ops
::
SequenceSliceGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
sequence_slice
,
sequence_slice
,
ops
::
SequenceSliceOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
SequenceSliceOpKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/sequence_softmax_op.cc
浏览文件 @
d84cdb7b
...
@@ -155,9 +155,10 @@ class SequenceSoftmaxGradOp : public framework::OperatorWithKernel {
...
@@ -155,9 +155,10 @@ class SequenceSoftmaxGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sequence_softmax
,
ops
::
SequenceSoftmaxOp
,
REGISTER_OPERATOR
(
sequence_softmax
,
ops
::
SequenceSoftmaxOp
,
ops
::
SequenceSoftmaxOpMaker
,
sequence_softmax_grad
,
ops
::
SequenceSoftmaxOpMaker
,
ops
::
SequenceSoftmaxGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
sequence_softmax_grad
,
ops
::
SequenceSoftmaxGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
sequence_softmax
,
sequence_softmax
,
ops
::
SequenceSoftmaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
SequenceSoftmaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
...
...
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
浏览文件 @
d84cdb7b
...
@@ -135,11 +135,12 @@ However the output only shares the LoD with input `X`.
...
@@ -135,11 +135,12 @@ However the output only shares the LoD with input `X`.
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
sigmoid_cross_entropy_with_logits
,
REGISTER_OP
ERATOR
(
sigmoid_cross_entropy_with_logits
,
ops
::
SigmoidCrossEntropyWithLogitsOp
,
ops
::
SigmoidCrossEntropyWithLogitsOp
,
ops
::
SigmoidCrossEntropyWithLogitsOpMaker
,
ops
::
SigmoidCrossEntropyWithLogitsOpMaker
,
sigmoid_cross_entropy_with_logits_grad
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
ops
::
SigmoidCrossEntropyWithLogitsGradOp
);
REGISTER_OPERATOR
(
sigmoid_cross_entropy_with_logits_grad
,
ops
::
SigmoidCrossEntropyWithLogitsGradOp
)
REGISTER_OP_CPU_KERNEL
(
sigmoid_cross_entropy_with_logits
,
REGISTER_OP_CPU_KERNEL
(
sigmoid_cross_entropy_with_logits
,
ops
::
SigmoidCrossEntropyWithLogitsKernel
<
ops
::
SigmoidCrossEntropyWithLogitsKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/smooth_l1_loss_op.cc
浏览文件 @
d84cdb7b
...
@@ -132,8 +132,9 @@ class SmoothL1LossGradOp : public framework::OperatorWithKernel {
...
@@ -132,8 +132,9 @@ class SmoothL1LossGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
smooth_l1_loss
,
ops
::
SmoothL1LossOp
,
ops
::
SmoothL1LossOpMaker
,
REGISTER_OPERATOR
(
smooth_l1_loss
,
ops
::
SmoothL1LossOp
,
ops
::
SmoothL1LossOpMaker
,
smooth_l1_loss_grad
,
ops
::
SmoothL1LossGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
smooth_l1_loss_grad
,
ops
::
SmoothL1LossGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
smooth_l1_loss
,
smooth_l1_loss
,
ops
::
SmoothL1LossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
SmoothL1LossKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/softmax_op.cc
浏览文件 @
d84cdb7b
...
@@ -160,8 +160,9 @@ class SoftmaxOpGrad : public framework::OperatorWithKernel {
...
@@ -160,8 +160,9 @@ class SoftmaxOpGrad : public framework::OperatorWithKernel {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
softmax
,
ops
::
SoftmaxOp
,
ops
::
SoftmaxOpMaker
,
softmax_grad
,
REGISTER_OPERATOR
(
softmax
,
ops
::
SoftmaxOp
,
ops
::
SoftmaxOpMaker
,
ops
::
SoftmaxOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
softmax_grad
,
ops
::
SoftmaxOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
softmax
,
ops
::
SoftmaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
softmax
,
ops
::
SoftmaxKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/spp_op.cc
浏览文件 @
d84cdb7b
...
@@ -92,7 +92,9 @@ class SppOpGrad : public framework::OperatorWithKernel {
...
@@ -92,7 +92,9 @@ class SppOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
spp
,
ops
::
SppOp
,
ops
::
SppOpMaker
,
spp_grad
,
ops
::
SppOpGrad
);
REGISTER_OPERATOR
(
spp
,
ops
::
SppOp
,
ops
::
SppOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
spp_grad
,
ops
::
SppOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
spp
,
ops
::
SppKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
spp
,
ops
::
SppKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
SppKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
SppKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/squared_l2_distance_op.cc
浏览文件 @
d84cdb7b
...
@@ -109,9 +109,10 @@ class SquaredL2DistanceGradOp : public framework::OperatorWithKernel {
...
@@ -109,9 +109,10 @@ class SquaredL2DistanceGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
squared_l2_distance
,
ops
::
SquaredL2DistanceOp
,
REGISTER_OPERATOR
(
squared_l2_distance
,
ops
::
SquaredL2DistanceOp
,
ops
::
SquaredL2DistanceOpMaker
,
squared_l2_distance_grad
,
ops
::
SquaredL2DistanceOpMaker
,
ops
::
SquaredL2DistanceGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
squared_l2_distance_grad
,
ops
::
SquaredL2DistanceGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
squared_l2_distance
,
squared_l2_distance
,
ops
::
SquaredL2DistanceKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
SquaredL2DistanceKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/squared_l2_norm_op.cc
浏览文件 @
d84cdb7b
...
@@ -67,8 +67,10 @@ $$Out = \sum_{i} X_{i}^2$$
...
@@ -67,8 +67,10 @@ $$Out = \sum_{i} X_{i}^2$$
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
squared_l2_norm
,
ops
::
SquaredL2NormOp
,
ops
::
SquaredL2NormOpMaker
,
REGISTER_OPERATOR
(
squared_l2_norm
,
ops
::
SquaredL2NormOp
,
squared_l2_norm_grad
,
ops
::
SquaredL2NormGradOp
);
ops
::
SquaredL2NormOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
squared_l2_norm_grad
,
ops
::
SquaredL2NormGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
squared_l2_norm
,
squared_l2_norm
,
ops
::
SquaredL2NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
ops
::
SquaredL2NormKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
...
...
paddle/fluid/operators/transpose_op.cc
浏览文件 @
d84cdb7b
...
@@ -118,8 +118,9 @@ class TransposeOpGrad : public framework::OperatorWithKernel {
...
@@ -118,8 +118,9 @@ class TransposeOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
transpose
,
ops
::
TransposeOp
,
ops
::
TransposeOpMaker
,
transpose_grad
,
REGISTER_OPERATOR
(
transpose
,
ops
::
TransposeOp
,
ops
::
TransposeOpMaker
,
ops
::
TransposeOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
transpose_grad
,
ops
::
TransposeOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
transpose
,
ops
::
TransposeKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
transpose
,
ops
::
TransposeKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
paddle/fluid/operators/unpool_op.cc
浏览文件 @
d84cdb7b
...
@@ -132,8 +132,9 @@ class UnpoolOpGrad : public framework::OperatorWithKernel {
...
@@ -132,8 +132,9 @@ class UnpoolOpGrad : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
unpool
,
ops
::
UnpoolOp
,
ops
::
Unpool2dOpMaker
,
unpool_grad
,
REGISTER_OPERATOR
(
unpool
,
ops
::
UnpoolOp
,
ops
::
Unpool2dOpMaker
,
ops
::
UnpoolOpGrad
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
unpool_grad
,
ops
::
UnpoolOpGrad
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
unpool
,
ops
::
UnpoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
unpool
,
ops
::
UnpoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
UnpoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
ops
::
UnpoolKernel
<
paddle
::
platform
::
CPUDeviceContext
,
double
>
);
...
...
paddle/fluid/operators/warpctc_op.cc
浏览文件 @
d84cdb7b
...
@@ -132,8 +132,9 @@ class WarpCTCGradOp : public framework::OperatorWithKernel {
...
@@ -132,8 +132,9 @@ class WarpCTCGradOp : public framework::OperatorWithKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP
(
warpctc
,
ops
::
WarpCTCOp
,
ops
::
WarpCTCOpMaker
,
warpctc_grad
,
REGISTER_OPERATOR
(
warpctc
,
ops
::
WarpCTCOp
,
ops
::
WarpCTCOpMaker
,
ops
::
WarpCTCGradOp
);
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
)
REGISTER_OPERATOR
(
warpctc_grad
,
ops
::
WarpCTCGradOp
)
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
warpctc
,
ops
::
WarpCTCKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
warpctc
,
ops
::
WarpCTCKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录