Skip to content

Commit

Permalink
Fix for MKLDNNDeviceContext error in matmul_v2_transpose_reshape fuse…
Browse files Browse the repository at this point in the history
… pass when GLOG_v set (#38554)

* glog fix

* changed approach
  • Loading branch information
jakpiase authored Dec 31, 2021
1 parent 730ccd9 commit 1d31764
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paddle/fluid/inference/api/analysis_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ void AnalysisPredictor::MkldnnPreSet(
void AnalysisPredictor::MkldnnPostReset() {
#ifdef PADDLE_WITH_MKLDNN
// In cache clearing mode.
if (config_.mkldnn_cache_capacity_ > 0) {
if (config_.mkldnn_cache_capacity_ > 0 &&
static_cast<platform::MKLDNNDeviceContext *>(
(&platform::DeviceContextPool::Instance())->Get(platform::CPUPlace()))
->GetCachedObjectsNumber() > 0) {
if (VLOG_IS_ON(2)) {
auto shape_blob_size = static_cast<platform::MKLDNNDeviceContext *>(
(&platform::DeviceContextPool::Instance())
Expand Down

0 comments on commit 1d31764

Please sign in to comment.