From 63b6a11b7564caf8bef1883cede1677c84b468c1 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Wed, 7 Sep 2022 14:02:19 +0800 Subject: [PATCH] Clear extra attrs of reduce op in OpMaker (#45786) * clear extra attrs of reduce op in opmaker * fix reduce_mean --- .../operators/reduce_ops/reduce_mean_op.cc | 1 + paddle/fluid/operators/reduce_ops/reduce_op.h | 4 -- paddle/phi/api/yaml/api_compat.yaml | 48 +++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index a5827b1e0a..9e15b347a0 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -79,6 +79,7 @@ class ReduceMeanDoubleGradOpBaseMaker : public imperative::GradOpBaseMakerBase { op.SetType("reduce_mean"); op.SetInput("X", x_gg); op.SetAttrMap(Attrs()); + op.SetDefaultAttrsMap(DefaultAttrsMap()); op.SetOutput("Out", out_grads); } return node; diff --git a/paddle/fluid/operators/reduce_ops/reduce_op.h b/paddle/fluid/operators/reduce_ops/reduce_op.h index df7804dc7a..d305a65e0d 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_op.h +++ b/paddle/fluid/operators/reduce_ops/reduce_op.h @@ -718,10 +718,6 @@ class ReduceOpMaker : public framework::OpProtoAndCheckerMaker { "(int, default -1)" "The dtype of output, default value is -1, the dtype is same as intput") .SetDefault(-1); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(string::Sprintf(R"DOC( %s Operator. diff --git a/paddle/phi/api/yaml/api_compat.yaml b/paddle/phi/api/yaml/api_compat.yaml index 310538f036..2f34993e7f 100644 --- a/paddle/phi/api/yaml/api_compat.yaml +++ b/paddle/phi/api/yaml/api_compat.yaml @@ -203,6 +203,11 @@ inputs: {x: X} outputs: {out: Out} +- api : frobenius_norm + backward : frobenius_norm_grad + extra : + attrs : [bool use_mkldnn = false] + - api : gelu backward : gelu_grad extra : @@ -288,6 +293,49 @@ outputs : out : Out +- api : reduce_all + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_amax + backward : reduce_amax_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_amin + backward : reduce_amin_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_any + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_max + backward : reduce_max_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_mean + backward : reduce_mean_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_min + backward : reduce_min_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_prod + backward : reduce_prod_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : reduce_sum + backward : reduce_sum_grad + extra : + attrs : [bool use_mkldnn = false] + - api : renorm backward : renorm_grad extra : -- GitLab