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

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

上级 dd0f9b96
......@@ -103,9 +103,6 @@ class RNNOpMaker : public framework::OpProtoAndCheckerMaker {
"mode",
"(string) rnn types, including: LSTM, GRU, RNN_RELU, RNN_TANH.");
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(
)DOC");
}
......
......@@ -39,23 +39,6 @@ class SeedOpMaker : public framework::OpProtoAndCheckerMaker {
void Make() override {
AddOutput("Out", "The output of seed op.");
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(
Seed Operator.
)DOC");
......
......@@ -66,16 +66,6 @@ Shape Operator.
Return the shape of the input.
)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 {
platform::errors::InvalidArgument(
"group should be larger than 0."));
});
AddAttr<bool>("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.
......
......@@ -260,16 +260,6 @@ class SliceOpMaker : public framework::OpProtoAndCheckerMaker {
.SetDefault({});
AddAttr<std::vector<int>>("decrease_axis", "(list<int>) decrease_axis")
.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(
Slice Operator.
......
......@@ -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<bool>(
"use_cudnn",
"(bool, default false) Only used in cudnn kernel, need install cudnn")
.SetDefault(false)
.AsExtra();
AddAttr<std::string>(
"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<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(
Softmax Operator.
......
......@@ -296,15 +296,46 @@ class SqueezeDoubleGradOpMaker : public framework::SingleGradOpMaker<T> {
// 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<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 @@
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 :
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册