未验证 提交 22f042ba 编写于 作者: Z zyfncg 提交者: GitHub

clear extra attrs of some op in opmaker (#45758)

上级 dd0f9b96
...@@ -103,9 +103,6 @@ class RNNOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -103,9 +103,6 @@ class RNNOpMaker : public framework::OpProtoAndCheckerMaker {
"mode", "mode",
"(string) rnn types, including: LSTM, GRU, RNN_RELU, RNN_TANH."); "(string) rnn types, including: LSTM, GRU, RNN_RELU, RNN_TANH.");
AddAttr<int>("seed", "seed to used if fix_seed is True").SetDefault(0); AddAttr<int>("seed", "seed to used if fix_seed is True").SetDefault(0);
AddAttr<bool>("is_test", "True if in test phase.")
.SetDefault(false)
.AsExtra();
AddComment(R"DOC( AddComment(R"DOC(
)DOC"); )DOC");
} }
......
...@@ -39,23 +39,6 @@ class SeedOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -39,23 +39,6 @@ class SeedOpMaker : public framework::OpProtoAndCheckerMaker {
void Make() override { void Make() override {
AddOutput("Out", "The output of seed op."); AddOutput("Out", "The output of seed op.");
AddAttr<int>("seed", "Dropout random seed.").SetDefault(0); AddAttr<int>("seed", "Dropout random seed.").SetDefault(0);
AddAttr<bool>("deterministic",
"(bool, default false) Whether to use deterministic "
"RandomSeedGenerator which "
"generate by `set_random_seed_generator`")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>(
"rng_name",
"use deterministic RandomSeedGenerator which name is `rng_name`")
.SetDefault("")
.AsExtra();
AddAttr<bool>("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( AddComment(R"DOC(
Seed Operator. Seed Operator.
)DOC"); )DOC");
......
...@@ -66,16 +66,6 @@ Shape Operator. ...@@ -66,16 +66,6 @@ Shape Operator.
Return the shape of the input. Return the shape of the input.
)DOC"); )DOC");
AddAttr<bool>("use_mkldnn",
"(bool, default false) Only used in mkldnn kernel")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>(
"mkldnn_data_type",
"(string, default \"float32\"). Data type of mkldnn kernel")
.SetDefault("float32")
.InEnum({"float32", "bfloat16", "int8"})
.AsExtra();
} }
}; };
......
...@@ -69,11 +69,6 @@ class ShuffleChannelOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -69,11 +69,6 @@ class ShuffleChannelOpMaker : public framework::OpProtoAndCheckerMaker {
platform::errors::InvalidArgument( platform::errors::InvalidArgument(
"group should be larger than 0.")); "group should be larger than 0."));
}); });
AddAttr<bool>("use_mkldnn",
"(bool, default false) Only used in mkldnn kernel")
.SetDefault(false)
.AsExtra();
AddComment(R"DOC( AddComment(R"DOC(
Shuffle Channel operator Shuffle Channel operator
This opearator shuffles the channels of input x. This opearator shuffles the channels of input x.
......
...@@ -260,16 +260,6 @@ class SliceOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -260,16 +260,6 @@ class SliceOpMaker : public framework::OpProtoAndCheckerMaker {
.SetDefault({}); .SetDefault({});
AddAttr<std::vector<int>>("decrease_axis", "(list<int>) decrease_axis") AddAttr<std::vector<int>>("decrease_axis", "(list<int>) decrease_axis")
.SetDefault({}); .SetDefault({});
AddAttr<bool>("use_mkldnn",
"(bool, default false) Only used in mkldnn kernel")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>(
"mkldnn_data_type",
"(string, default \"float32\"). Data type of mkldnn kernel")
.SetDefault("float32")
.InEnum({"float32", "int8", "bfloat16"})
.AsExtra();
AddComment(R"DOC( AddComment(R"DOC(
Slice Operator. Slice Operator.
......
...@@ -85,11 +85,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -85,11 +85,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker {
"The dimension index of Input(x) to perform softmax," "The dimension index of Input(x) to perform softmax,"
"default -1 for last dimension") "default -1 for last dimension")
.SetDefault(-1); .SetDefault(-1);
AddAttr<bool>(
"use_cudnn",
"(bool, default false) Only used in cudnn kernel, need install cudnn")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>( AddAttr<std::string>(
"data_format", "data_format",
"(string, default NCHW) Only used in " "(string, default NCHW) Only used in "
...@@ -97,21 +92,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -97,21 +92,6 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker {
"Defaults to \"NHWC\". Specify the data format of the output data, " "Defaults to \"NHWC\". Specify the data format of the output data, "
"the input will be transformed automatically. ") "the input will be transformed automatically. ")
.SetDefault("AnyLayout"); .SetDefault("AnyLayout");
AddAttr<bool>("use_mkldnn",
"(bool, default false) Only used in mkldnn kernel")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>(
"mkldnn_data_type",
"(string, default \"float32\"). Data type of mkldnn kernel")
.SetDefault("float32")
.InEnum({"float32", "bfloat16"})
.AsExtra();
AddAttr<bool>("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( AddComment(R"DOC(
Softmax Operator. Softmax Operator.
......
...@@ -296,15 +296,46 @@ class SqueezeDoubleGradOpMaker : public framework::SingleGradOpMaker<T> { ...@@ -296,15 +296,46 @@ class SqueezeDoubleGradOpMaker : public framework::SingleGradOpMaker<T> {
// squeeze_grad, in this way, the framework can reuse the memory of X // squeeze_grad, in this way, the framework can reuse the memory of X
// immediately the squeeze2_op is finished. // immediately the squeeze2_op is finished.
// Considering compatibility issues, we could not fix squeeze2_op // Considering compatibility issues, we could not fix squeeze2_op
class Squeeze2OpMaker : public SqueezeOpMaker { class Squeeze2OpMaker : public framework::OpProtoAndCheckerMaker {
public: public:
void Make() override { 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", AddOutput("XShape",
"XShape is just used to store the shape and lod of X, which will " "XShape is just used to store the shape and lod of X, which will "
"be used in SqueezeGradOp.") "be used in SqueezeGradOp.")
.AsIntermediate() .AsIntermediate()
.AsExtra(); .AsExtra();
AddAttr<std::vector<int>>("axes",
"(std::vector<int>). 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");
} }
}; };
......
...@@ -281,22 +281,54 @@ ...@@ -281,22 +281,54 @@
outputs : outputs :
out : Out out : Out
- api : prelu
backward : prelu_grad
extra :
attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false]
- api : renorm - api : renorm
backward : renorm_grad backward : renorm_grad
extra : extra :
attrs : [bool use_mkldnn = false, bool use_cudnn = false] 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 - api : solve
inputs : inputs :
{x : X, y : Y} {x : X, y : Y}
outputs : outputs :
out : Out out : Out
- api : squeeze (squeeze2)
backward : squeeze_grad (squeeze2_grad)
extra :
attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"]
- api : stack - api : stack
backward : stack_grad backward : stack_grad
extra : extra :
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册