提交 43e59fda 编写于 作者: X xiaolil1

fix crash bug and add bias reorder

上级 caf95767
...@@ -152,7 +152,8 @@ class ConvMKLDNNHandler : public platform::MKLDNNHandler { ...@@ -152,7 +152,8 @@ class ConvMKLDNNHandler : public platform::MKLDNNHandler {
auto user_bias_pd = user_bias_memory_p->get_primitive_desc(); auto user_bias_pd = user_bias_memory_p->get_primitive_desc();
auto bias_pd = conv_pd_->bias_primitive_desc(); auto bias_pd = conv_pd_->bias_primitive_desc();
return this->AcquireMemory(bias_pd, user_bias_pd, user_bias_memory_p, 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<mkldnn::convolution_forward> AcquireConvolution( std::shared_ptr<mkldnn::convolution_forward> AcquireConvolution(
......
...@@ -210,6 +210,8 @@ class MKLDNNHandler { ...@@ -210,6 +210,8 @@ class MKLDNNHandler {
std::shared_ptr<mkldnn::primitive> reorder_p; std::shared_ptr<mkldnn::primitive> reorder_p;
if (mpd != user_mpd) { if (mpd != user_mpd) {
target_memory_p = std::make_shared<mkldnn::memory>(mpd); target_memory_p = std::make_shared<mkldnn::memory>(mpd);
auto reorder_p =
std::make_shared<mkldnn::reorder>(*user_memory_p, *target_memory_p);
if(is_INT8){ if(is_INT8){
mkldnn::primitive_attr attri; mkldnn::primitive_attr attri;
attri.set_output_scales(mask, scale_data); attri.set_output_scales(mask, scale_data);
...@@ -218,9 +220,6 @@ class MKLDNNHandler { ...@@ -218,9 +220,6 @@ class MKLDNNHandler {
new mkldnn::reorder::primitive_desc(mpd, user_mpd, attri)); new mkldnn::reorder::primitive_desc(mpd, user_mpd, attri));
auto reorder_p = auto reorder_p =
std::shared_ptr<mkldnn::reorder>(new mkldnn::reorder(*reorder_pd, *user_memory_p, *target_memory_p)); std::shared_ptr<mkldnn::reorder>(new mkldnn::reorder(*reorder_pd, *user_memory_p, *target_memory_p));
} else{
auto reorder_p =
std::make_shared<mkldnn::reorder>(*user_memory_p, *target_memory_p);
} }
dev_ctx_.SetBlob(key_reorder_p, reorder_p); dev_ctx_.SetBlob(key_reorder_p, reorder_p);
pipeline.push_back(*reorder_p); pipeline.push_back(*reorder_p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册