From 43e59fdac39d9e5b809825e06099f5bcda298d82 Mon Sep 17 00:00:00 2001 From: xiaolil1 Date: Sun, 30 Sep 2018 00:11:22 +0800 Subject: [PATCH] fix crash bug and add bias reorder --- paddle/fluid/operators/conv_mkldnn_op.cc | 3 ++- paddle/fluid/platform/mkldnn_helper.h | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/conv_mkldnn_op.cc b/paddle/fluid/operators/conv_mkldnn_op.cc index 11b7efbe00c..0c76e122b1a 100644 --- a/paddle/fluid/operators/conv_mkldnn_op.cc +++ b/paddle/fluid/operators/conv_mkldnn_op.cc @@ -152,7 +152,8 @@ class ConvMKLDNNHandler : public platform::MKLDNNHandler { auto user_bias_pd = user_bias_memory_p->get_primitive_desc(); auto bias_pd = conv_pd_->bias_primitive_desc(); return this->AcquireMemory(bias_pd, user_bias_pd, user_bias_memory_p, - "@bias_mem_p", pipeline); + "@bias_mem_p", pipeline, + false, is_INT8, scale_data, mask); } std::shared_ptr AcquireConvolution( diff --git a/paddle/fluid/platform/mkldnn_helper.h b/paddle/fluid/platform/mkldnn_helper.h index df757481ee4..c5026194e0a 100644 --- a/paddle/fluid/platform/mkldnn_helper.h +++ b/paddle/fluid/platform/mkldnn_helper.h @@ -210,6 +210,8 @@ class MKLDNNHandler { std::shared_ptr reorder_p; if (mpd != user_mpd) { target_memory_p = std::make_shared(mpd); + auto reorder_p = + std::make_shared(*user_memory_p, *target_memory_p); if(is_INT8){ mkldnn::primitive_attr attri; attri.set_output_scales(mask, scale_data); @@ -218,9 +220,6 @@ class MKLDNNHandler { new mkldnn::reorder::primitive_desc(mpd, user_mpd, attri)); auto reorder_p = std::shared_ptr(new mkldnn::reorder(*reorder_pd, *user_memory_p, *target_memory_p)); - } else{ - auto reorder_p = - std::make_shared(*user_memory_p, *target_memory_p); } dev_ctx_.SetBlob(key_reorder_p, reorder_p); pipeline.push_back(*reorder_p); -- GitLab