From 23def39672e7fbeaac678a8889187e40dab737da Mon Sep 17 00:00:00 2001 From: YuanRisheng Date: Tue, 6 Sep 2022 14:16:19 +0800 Subject: [PATCH] fix mkldnn bugs (#45770) --- paddle/fluid/framework/operator.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index a03d75e3fe7..32933ef6617 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -1328,8 +1328,10 @@ bool OperatorWithKernel::SupportsMKLDNN( auto has_phi_kernel = std::any_of(phi_kernels.begin(), phi_kernels.end(), - [](phi::KernelKeyMap::const_reference kern_pair) { - return kern_pair.first.backend() == phi::Backend::ONEDNN; + [data_type](phi::KernelKeyMap::const_reference kern_pair) { + return kern_pair.first.backend() == phi::Backend::ONEDNN && + kern_pair.first.dtype() == + framework::TransToPhiDataType(data_type); }); if (has_phi_kernel) { return true; -- GitLab