未验证 提交 eb529128 编写于 作者: 王明冬 提交者: GitHub

fix the attributes error in transpose.pbtxt,test=develop. (#33770)

上级 2c4cc68f
......@@ -34,10 +34,13 @@ MatmulTransposeReshapeMKLDNNPass::MatmulTransposeReshapeMKLDNNPass() {
.IsTensor()
.End()
.AddAttr("alpha") // unconstrained. can be any float value.
.IsType<float>()
.End()
.AddAttr("transpose_X") // unconstrained. can be any bool value.
.IsType<bool>()
.End()
.AddAttr("transpose_Y") // unconstrained. can be any bool value.
.IsType<bool>()
.End();
AddOpCompat(OpCompat("transpose2"))
......@@ -51,9 +54,7 @@ MatmulTransposeReshapeMKLDNNPass::MatmulTransposeReshapeMKLDNNPass() {
.IsTensor()
.End()
.AddAttr("axis") // ints
.End()
.AddAttr("data_format")
.IsStringIn({"NHWC", "NCHW", "AnyLayout"})
.IsType<std::vector<int>>()
.End();
AddOpCompat(OpCompat("reshape2"))
......@@ -75,6 +76,7 @@ MatmulTransposeReshapeMKLDNNPass::MatmulTransposeReshapeMKLDNNPass() {
.IsTensor()
.End()
.AddAttr("shape") // ints
.IsType<std::vector<int>>()
.End();
}
void MatmulTransposeReshapeMKLDNNPass::ApplyImpl(ir::Graph *graph) const {
......
......@@ -28,7 +28,6 @@ void SetOp(ProgramDesc *prog, const std::string &type,
op->SetOutput("Out", {outputs[0]});
if (type == "transpose2") {
op->SetAttr("axis", std::vector<int>({0, 2, 1, 3}));
op->SetAttr("data_format", std::string("NCHW"));
op->SetOutput("XShape", {outputs[1]});
}
if (type == "reshape2") {
......
......@@ -10,12 +10,12 @@ def {
name: "axis"
type: INTS
}
}
extra {
attrs {
name: "data_format"
type: STRING
}
}
extra {
attrs {
name: "use_mkldnn"
type: BOOLEAN
......
......@@ -13,12 +13,12 @@ def {
name: "axis"
type: INTS
}
}
extra {
attrs {
name: "data_format"
type: STRING
}
}
extra {
attrs {
name: "use_mkldnn"
type: BOOLEAN
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册