Skip to content

Commit bccb0ba

Browse files
sfraczekluotao1
authored andcommitted
fix quantize_squash_pass segfault when no tensor linked to Bias (#17292)
* fix quantize_squash_pass segfault when there is no tensor linked do Bias input test=develop * add googlenet test test=develop * fix concat CreateKey not using input format test=develop
1 parent 3db9c8c commit bccb0ba

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void CPUQuantizeSquashPass::Squash(
8181
auto quant_out_var_name = quant_out->Name();
8282
auto next_op_inputs = next_op_desc->InputNames();
8383
for (const auto& name : next_op_inputs) {
84+
if (next_op_desc->Inputs().count(name) == 0 ||
85+
next_op_desc->Input(name).size() == 0)
86+
continue;
8487
auto var_name = next_op_desc->Input(name)[0];
8588
if (var_name.compare(quant_out_var_name) == 0) {
8689
next_op_desc->SetInput(

paddle/fluid/inference/tests/api/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ if(WITH_MKLDNN)
194194
inference_download_and_uncompress(${INT8_VGG19_MODEL_DIR} "${INFERENCE_URL}/int8" "VGG19_int8_model.tar.gz" )
195195
endif()
196196
inference_analysis_api_int8_test(test_analyzer_int8_vgg19 ${INT8_VGG19_MODEL_DIR} ${INT8_DATA_DIR} analyzer_int8_image_classification_tester.cc)
197+
198+
#googlenet int8
199+
set(INT8_GOOGLENET_MODEL_DIR "${INT8_DATA_DIR}/googlenet")
200+
if (NOT EXISTS ${INT8_GOOGLENET_MODEL_DIR})
201+
inference_download_and_uncompress(${INT8_GOOGLENET_MODEL_DIR} "${INFERENCE_URL}/int8" "GoogleNet_int8_model.tar.gz" )
202+
endif()
203+
inference_analysis_api_int8_test(test_analyzer_int8_googlenet ${INT8_GOOGLENET_MODEL_DIR} ${INT8_DATA_DIR} analyzer_int8_image_classification_tester.cc SERIAL)
197204
endif()
198205

199206
# bert, max_len=20, embedding_dim=128

paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ std::string CreateKey(const paddle::framework::ExecutionContext& ctx,
7979
platform::MKLDNNHandler::AppendKey(&key, std::to_string(concat_axis));
8080
platform::MKLDNNHandler::AppendKey(&key, ctx.op().Output("Out"));
8181
platform::MKLDNNHandler::AppendKey(&key, std::to_string(dt));
82+
platform::MKLDNNHandler::AppendKey(&key,
83+
std::to_string(multi_input[0]->format()));
8284
return key;
8385
}
8486

0 commit comments

Comments
 (0)