Skip to content

Commit 1d31764

Browse files
authored
Fix for MKLDNNDeviceContext error in matmul_v2_transpose_reshape fuse pass when GLOG_v set (#38554)
* glog fix * changed approach
1 parent 730ccd9 commit 1d31764

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

paddle/fluid/inference/api/analysis_predictor.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ void AnalysisPredictor::MkldnnPreSet(
409409
void AnalysisPredictor::MkldnnPostReset() {
410410
#ifdef PADDLE_WITH_MKLDNN
411411
// In cache clearing mode.
412-
if (config_.mkldnn_cache_capacity_ > 0) {
412+
if (config_.mkldnn_cache_capacity_ > 0 &&
413+
static_cast<platform::MKLDNNDeviceContext *>(
414+
(&platform::DeviceContextPool::Instance())->Get(platform::CPUPlace()))
415+
->GetCachedObjectsNumber() > 0) {
413416
if (VLOG_IS_ON(2)) {
414417
auto shape_blob_size = static_cast<platform::MKLDNNDeviceContext *>(
415418
(&platform::DeviceContextPool::Instance())

0 commit comments

Comments
 (0)