未验证 提交 633c71c2 编写于 作者: Z Zuza 提交者: GitHub

Fix fc_mkldnn format issue (#38890)

上级 5dc20c27
......@@ -95,8 +95,17 @@ void CPUQuantizePass::QuantizeInput(Graph* g, Node* op, Node* input,
q_desc.SetAttr("Shift", shift);
q_desc.SetAttr("is_negative_input", !is_input_unsigned);
q_desc.SetAttr("output_format",
Has("data_layout") ? Get<std::string>("data_layout") : "NHWC");
// fix to fc format error
if (op->Op()->Type() == "fc" &&
op->Op()->GetAttrIfExists<int>("in_num_col_dims") == 2) {
q_desc.SetAttr("output_format", Has("data_layout")
? Get<std::string>("data_layout")
: "NCHW");
} else {
q_desc.SetAttr("output_format", Has("data_layout")
? Get<std::string>("data_layout")
: "NHWC");
}
auto quantize_op = g->CreateOpNode(&q_desc); // OpDesc will be copied.
// update op's input
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册