diff --git a/paddle/fluid/operators/rnn_op.cc b/paddle/fluid/operators/rnn_op.cc index aba720a99ba27329bdce34ac1f3c8916087d8792..4a97afdfc4a069e5d3c42a19f1c7c64b832f8604 100644 --- a/paddle/fluid/operators/rnn_op.cc +++ b/paddle/fluid/operators/rnn_op.cc @@ -103,9 +103,6 @@ class RNNOpMaker : public framework::OpProtoAndCheckerMaker { "mode", "(string) rnn types, including: LSTM, GRU, RNN_RELU, RNN_TANH."); AddAttr("seed", "seed to used if fix_seed is True").SetDefault(0); - AddAttr("is_test", "True if in test phase.") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( )DOC"); } diff --git a/paddle/fluid/operators/seed_op.cc b/paddle/fluid/operators/seed_op.cc index 527884ec9c9b6b013598c631aa9ae79e4fc3f852..7de155b01c20eae0c62bdfd295c55c40ded910f2 100644 --- a/paddle/fluid/operators/seed_op.cc +++ b/paddle/fluid/operators/seed_op.cc @@ -39,23 +39,6 @@ class SeedOpMaker : public framework::OpProtoAndCheckerMaker { void Make() override { AddOutput("Out", "The output of seed op."); AddAttr("seed", "Dropout random seed.").SetDefault(0); - AddAttr("deterministic", - "(bool, default false) Whether to use deterministic " - "RandomSeedGenerator which " - "generate by `set_random_seed_generator`") - .SetDefault(false) - .AsExtra(); - AddAttr( - "rng_name", - "use deterministic RandomSeedGenerator which name is `rng_name`") - .SetDefault("") - .AsExtra(); - AddAttr("force_cpu", - "(bool, default false) Force fill output variable to cpu " - "memory. Otherwise, fill output variable to the running " - "device") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( Seed Operator. )DOC"); diff --git a/paddle/fluid/operators/shape_op.cc b/paddle/fluid/operators/shape_op.cc index cbd1015352a70e17b167a42e694ac2bf18414ae6..14f4b00b60d735d3700ae3b475b779ceb9da9a08 100644 --- a/paddle/fluid/operators/shape_op.cc +++ b/paddle/fluid/operators/shape_op.cc @@ -66,16 +66,6 @@ Shape Operator. Return the shape of the input. )DOC"); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); - AddAttr( - "mkldnn_data_type", - "(string, default \"float32\"). Data type of mkldnn kernel") - .SetDefault("float32") - .InEnum({"float32", "bfloat16", "int8"}) - .AsExtra(); } }; diff --git a/paddle/fluid/operators/shuffle_channel_op.cc b/paddle/fluid/operators/shuffle_channel_op.cc index 4a3668b11405921ac9062acb5bbe75727472940a..9fc7c6488f460710f2af5aa9d8f46a25b4056f32 100644 --- a/paddle/fluid/operators/shuffle_channel_op.cc +++ b/paddle/fluid/operators/shuffle_channel_op.cc @@ -69,11 +69,6 @@ class ShuffleChannelOpMaker : public framework::OpProtoAndCheckerMaker { platform::errors::InvalidArgument( "group should be larger than 0.")); }); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); - AddComment(R"DOC( Shuffle Channel operator This opearator shuffles the channels of input x. diff --git a/paddle/fluid/operators/slice_op.cc b/paddle/fluid/operators/slice_op.cc index f42ebbe0399eb0632e0cbf4d7653f8f180efbd77..9d9e5816db70282f1f7544ddde88185bb8972a8f 100644 --- a/paddle/fluid/operators/slice_op.cc +++ b/paddle/fluid/operators/slice_op.cc @@ -260,16 +260,6 @@ class SliceOpMaker : public framework::OpProtoAndCheckerMaker { .SetDefault({}); AddAttr>("decrease_axis", "(list) decrease_axis") .SetDefault({}); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); - AddAttr( - "mkldnn_data_type", - "(string, default \"float32\"). Data type of mkldnn kernel") - .SetDefault("float32") - .InEnum({"float32", "int8", "bfloat16"}) - .AsExtra(); AddComment(R"DOC( Slice Operator. diff --git a/paddle/fluid/operators/softmax_op.cc b/paddle/fluid/operators/softmax_op.cc index d468e4a17f6b349feb7e2e4feeb0112421c78ce8..3966b850c7b830ae0a766e951032096564599483 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -85,11 +85,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { "The dimension index of Input(x) to perform softmax," "default -1 for last dimension") .SetDefault(-1); - AddAttr( - "use_cudnn", - "(bool, default false) Only used in cudnn kernel, need install cudnn") - .SetDefault(false) - .AsExtra(); AddAttr( "data_format", "(string, default NCHW) Only used in " @@ -97,21 +92,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { "Defaults to \"NHWC\". Specify the data format of the output data, " "the input will be transformed automatically. ") .SetDefault("AnyLayout"); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); - AddAttr( - "mkldnn_data_type", - "(string, default \"float32\"). Data type of mkldnn kernel") - .SetDefault("float32") - .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) - .AsExtra(); AddComment(R"DOC( Softmax Operator. diff --git a/paddle/fluid/operators/squeeze_op.cc b/paddle/fluid/operators/squeeze_op.cc index 2d9e1e121c30a23c2e6343d3515b74b70d07149d..561d1d31f1475ac96c1456ebdeb95738f516f0eb 100644 --- a/paddle/fluid/operators/squeeze_op.cc +++ b/paddle/fluid/operators/squeeze_op.cc @@ -296,15 +296,46 @@ class SqueezeDoubleGradOpMaker : public framework::SingleGradOpMaker { // squeeze_grad, in this way, the framework can reuse the memory of X // immediately the squeeze2_op is finished. // Considering compatibility issues, we could not fix squeeze2_op -class Squeeze2OpMaker : public SqueezeOpMaker { +class Squeeze2OpMaker : public framework::OpProtoAndCheckerMaker { public: void Make() override { - SqueezeOpMaker::Make(); + AddInput("X", "(Tensor). The input tensor of squeeze operator."); + AddOutput("Out", "(Tensor). The output tensor of squeeze operator."); AddOutput("XShape", "XShape is just used to store the shape and lod of X, which will " "be used in SqueezeGradOp.") .AsIntermediate() .AsExtra(); + AddAttr>("axes", + "(std::vector). List of integers," + " indicating the dimensions to squeeze.") + .SetDefault({}) + .SupportTensor(); + AddComment(R"DOC( + Squeeze2 Operator. + + Remove single-dimensional entries from the shape of a tensor. + Takes a parameter axes with a list of axes to squeeze. + If axes is not provided, all the single dimensions will be removed from the shape. + If an axis is selected with shape entry not equal to one, an error is raised. + + Examples: + Case 1: + Given + X.shape = (1, 3, 1, 5) + and + axes = [0] + we get: + Out.shape = (3, 1, 5) + + Case 2: + Given + X.shape = (1, 3, 1, 5) + and + axes = [] + we get: + Out.shape = (3, 5) + )DOC"); } }; diff --git a/paddle/phi/api/yaml/api_compat.yaml b/paddle/phi/api/yaml/api_compat.yaml index 473dc9a17844c8a6c3f991497c2c775583f53d18..14d54df78322e259d26c1219da8983576464aba4 100644 --- a/paddle/phi/api/yaml/api_compat.yaml +++ b/paddle/phi/api/yaml/api_compat.yaml @@ -281,22 +281,54 @@ outputs : out : Out -- api : prelu - backward : prelu_grad - extra : - attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] - - api : renorm backward : renorm_grad extra : attrs : [bool use_mkldnn = false, bool use_cudnn = false] +- api : rnn + backward : rnn_grad + extra : + attrs : [bool is_test = false] + +- api : seed + extra : + attrs : [bool deterministic = false, str rng_name = "", bool force_cpu = false] + +- api : shape + extra : + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] + +- api : shuffle_channel + backward : shuffle_channel_grad + extra : + attrs : [bool use_mkldnn = false] + +- api : slice + backward : slice_grad + extra : + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] + +- api : softmax + backward : softmax_grad + extra : + attrs : [bool use_cudnn = false, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] +- api : prelu + backward : prelu_grad + extra : + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] + - api : solve inputs : {x : X, y : Y} outputs : out : Out +- api : squeeze (squeeze2) + backward : squeeze_grad (squeeze2_grad) + extra : + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] + - api : stack backward : stack_grad extra :