From c0808cfedeb35fd1e782338d932e669c63e5ad94 Mon Sep 17 00:00:00 2001 From: rongzha1 Date: Fri, 25 Oct 2019 15:40:25 +0800 Subject: [PATCH 1/2] rm int8 sum workaround due to mkldnn lib update --- .../mkldnn/mkldnn_quantized_elemwise_add.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc b/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc index e1e76817f875..6b0e7b09deb1 100644 --- a/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc +++ b/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc @@ -161,8 +161,14 @@ static void MKLDNNQuantizedElemwiseAddForward(const nnvm::NodeAttrs& attrs, cons std::vector in_desc; in_desc.push_back(dataA_mem->get_desc()); in_desc.push_back(dataB_mem->get_desc()); - auto output_desc = dataA_mem->get_desc(); - output_desc.data.data_type = static_cast(output_data_type); + size_t i_ndim = in_data[quantized_elemwise_add_enum::kDataA].shape().ndim(); + mkldnn::memory::dims i_dims = mkldnn::memory::dims(i_ndim); + for (size_t i = 0; i < i_ndim; i++) { + i_dims[i] = static_cast(in_data[quantized_elemwise_add_enum::kDataA].shape()[i]); + } + auto output_desc = mkldnn::memory::desc(i_dims, + output_data_type, + mkldnn::memory::format_tag::any); mkldnn::sum::primitive_desc pdesc(output_desc, scales, in_desc, engine); auto mem = CreateMKLDNNMem(out_data[quantized_elemwise_add_enum::kOut], pdesc.dst_desc(), From 9ec635fec57f13cbfb20a53f88771289d281696e Mon Sep 17 00:00:00 2001 From: rongzha1 Date: Mon, 28 Oct 2019 10:06:47 +0800 Subject: [PATCH 2/2] simple dims asignments in mkldnn_quantized_elemwise_add.cc --- .../quantization/mkldnn/mkldnn_quantized_elemwise_add.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc b/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc index 6b0e7b09deb1..2078ac4fead8 100644 --- a/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc +++ b/src/operator/quantization/mkldnn/mkldnn_quantized_elemwise_add.cc @@ -161,11 +161,8 @@ static void MKLDNNQuantizedElemwiseAddForward(const nnvm::NodeAttrs& attrs, cons std::vector in_desc; in_desc.push_back(dataA_mem->get_desc()); in_desc.push_back(dataB_mem->get_desc()); - size_t i_ndim = in_data[quantized_elemwise_add_enum::kDataA].shape().ndim(); - mkldnn::memory::dims i_dims = mkldnn::memory::dims(i_ndim); - for (size_t i = 0; i < i_ndim; i++) { - i_dims[i] = static_cast(in_data[quantized_elemwise_add_enum::kDataA].shape()[i]); - } + const auto in_shape = in_data[quantized_elemwise_add_enum::kDataA].shape(); + mkldnn::memory::dims i_dims(in_shape.begin(), in_shape.end()); auto output_desc = mkldnn::memory::desc(i_dims, output_data_type, mkldnn::memory::format_tag::any);