From 01c4ad80db1b55b578a8dbda8905266e1bba54bb Mon Sep 17 00:00:00 2001 From: piotrekobi <48731682+piotrekobi@users.noreply.github.com> Date: Tue, 5 Jul 2022 13:24:15 +0200 Subject: [PATCH] Fix for ernie3.0 int8 (#43992) * Fix for ernie3.0 int8 * Move changes above comment --- paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc index 1755b0f2082..79551b6d59a 100644 --- a/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc @@ -170,6 +170,9 @@ class FCPrimitiveFactory { // In case of 2 dims, we set the only possible format, nc if (dim_num == 2) { out->set_format(MKLDNNMemoryFormat::nc); + out->set_mem_desc({phi::vectorize(out->dims()), + platform::MKLDNNGetDataType(), + out->format()}); // In case of 3 dims, we generate a format that is based on number // of output dims and the layout of input format (nchw or nhwc). } else if (dim_num == 3) { @@ -185,9 +188,6 @@ class FCPrimitiveFactory { } else { out->set_format(in_format); } - out->set_mem_desc({phi::vectorize(out->dims()), - platform::MKLDNNGetDataType(), - out->format()}); } void UpdateDataPointers(const ExecutionContext& ctx, -- GitLab