From b211f02b687bf3b2462337df52521706c661d4d9 Mon Sep 17 00:00:00 2001 From: Pei Yang Date: Tue, 7 Sep 2021 18:59:13 +0800 Subject: [PATCH] add as-extra for softplus/leaky_relu/softmax (#35493) --- paddle/fluid/operators/activation_op.cc | 9 ++++++--- paddle/fluid/operators/softmax_op.cc | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index 7b98da04bc..60b3dbb25c 100644 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -415,7 +415,8 @@ class LeakyReluOpMaker : public framework::OpProtoAndCheckerMaker { .SetDefault(0.02f); AddAttr("use_mkldnn", "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddComment(R"DOC( LeakyRelu Activation Operator. @@ -439,11 +440,13 @@ class SoftplusOpMaker : public framework::OpProtoAndCheckerMaker { .SetDefault(20.0f); AddAttr("use_mkldnn", "(bool, default false) Only used in mkldnn kernel.") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddAttr( "use_cudnn", "(bool, default false) Only used in cudnn kernel, need install cudnn.") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddComment(R"DOC( :strong:`Softplus Activation Operator` diff --git a/paddle/fluid/operators/softmax_op.cc b/paddle/fluid/operators/softmax_op.cc index 5e7244f439..4b01799530 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -110,7 +110,8 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { AddAttr( "use_cudnn", "(bool, default false) Only used in cudnn kernel, need install cudnn") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddAttr( "data_format", "(string, default NCHW) Only used in " @@ -120,16 +121,19 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { .SetDefault("AnyLayout"); AddAttr("use_mkldnn", "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddAttr( "mkldnn_data_type", "(string, default \"float32\"). Data type of mkldnn kernel") .SetDefault("float32") - .InEnum({"float32", "bfloat16"}); + .InEnum({"float32", "bfloat16"}) + .AsExtra(); AddAttr("is_test", "(bool, default false) Set to true for inference only, false " "for training. Some layers may run faster when this is true.") - .SetDefault(false); + .SetDefault(false) + .AsExtra(); AddComment(R"DOC( Softmax Operator. -- GitLab