diff --git a/paddle/fluid/operators/conv_mkldnn_op.cc b/paddle/fluid/operators/conv_mkldnn_op.cc index 27a4f38e40f209e252343014ff3237369c476297..64be8a4b16314d58fb84b734088b03c61d1e79d0 100644 --- a/paddle/fluid/operators/conv_mkldnn_op.cc +++ b/paddle/fluid/operators/conv_mkldnn_op.cc @@ -350,29 +350,10 @@ std::cout<<"fuse_relu = "<1? weights_tz[1]*weights_tz[0] : weights_tz[0]) : 1; float scale_in_data = *(scale_in->data()); - -for(int i=0; i<50; i++){ - printf("%f ", *(input_data+i)/scale_in_data); -} -printf("\n");fflush(stdout); - std::vector scale_weights_data(count); for(int i=0; idata() + i); @@ -498,6 +479,7 @@ std::cout< dst_memory_p; if(is_INT8){ @@ -528,7 +510,7 @@ std::cout<(output_data)); } } -std::cout<<"input fmt = "<format()<<" input dt = "<type())<<" output fmt = "<format()<<" output dt = "<type())<<" dst fmt = "<get_primitive_desc().desc().data.format<<" dst dt = "<get_primitive_desc().desc().data.data_type<(output_data)); auto reorder_pd = std::shared_ptr( - new reorder::primitive_desc(src_pd, dst_pd, attri)); + new reorder::primitive_desc(dst_pd, src_pd, attri)); auto reorder_p= std::shared_ptr(new reorder(*reorder_pd, *src_memory_p, dst_memory)); pipeline.push_back(*reorder_p); diff --git a/paddle/fluid/operators/quantize_op.cc b/paddle/fluid/operators/quantize_op.cc index 1748e645d76a79a1305dcd0c13b6dd8eb91eb0ec..cb5a9e4c1c8d6f94e8dce9eb753fb3763625baa4 100644 --- a/paddle/fluid/operators/quantize_op.cc +++ b/paddle/fluid/operators/quantize_op.cc @@ -47,35 +47,9 @@ std::cout<<"this is quantize op!!!!!!!!!!!!!!"< dst_tz = paddle::framework::vectorize2int(output->dims()); const T* input_data = input->data(); - uint8_t* output_data = output->mutable_data(ctx.GetPlace()); + T* output_data = output->mutable_data(ctx.GetPlace()); std::vector scale_data = {*(scale->data())}; -FILE *fp = fopen("quant_input.txt","w"); -printf("quantize check!!!!\n"); -std::vector tz = paddle::framework::vectorize2int(input->dims()); -int count=1; -for(int i=0; i(output_data)); + auto dst_memory = mkldnn::memory(dst_pd, to_void_cast(output_data)); auto reorder_pd = std::shared_ptr( - new reorder::primitive_desc(src_pd, dst_pd, attri)); + new reorder::primitive_desc(dst_pd, src_pd, attri)); auto reorder_p= std::shared_ptr(new reorder(*reorder_pd, *src_memory_p, dst_memory)); pipeline.push_back(*reorder_p); diff --git a/paddle/fluid/platform/mkldnn_helper.h b/paddle/fluid/platform/mkldnn_helper.h index 87ddead5c85dbd95b45e3ea68cd9ee76efc6ba7c..6f2814df1ade3f2cb2f0a38de7ed43d52f682ae9 100644 --- a/paddle/fluid/platform/mkldnn_helper.h +++ b/paddle/fluid/platform/mkldnn_helper.h @@ -212,18 +212,16 @@ class MKLDNNHandler { std::shared_ptr reorder_p; if (mpd != user_mpd) { target_memory_p = std::make_shared(mpd); - std::shared_ptr reorder_p;// = - //std::make_shared(*user_memory_p, *target_memory_p); + 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); auto reorder_pd = std::shared_ptr( - new mkldnn::reorder::primitive_desc(user_mpd, mpd, attri)); - reorder_p = + 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{ - reorder_p = std::make_shared(*user_memory_p, *target_memory_p); } dev_ctx_.SetBlob(key_reorder_p, reorder_p); pipeline.push_back(*reorder_p);