Skip to content

Commit e2fdb08

Browse files
authored
fix bug of slice_grad using use_mkldnn attr (#37571)
1 parent 3c10960 commit e2fdb08

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

paddle/fluid/framework/operator.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,9 @@ bool OperatorWithKernel::SupportsMKLDNN(
10651065

10661066
bool OperatorWithKernel::CanMKLDNNBeUsed(const framework::ExecutionContext& ctx,
10671067
proto::VarType::Type data_type) const {
1068-
bool use_mkldnn_ctx =
1069-
ctx.Attr<bool>("use_mkldnn") && platform::is_cpu_place(ctx.GetPlace());
1068+
bool use_mkldnn_ctx = ctx.HasAttr("use_mkldnn") &&
1069+
ctx.Attr<bool>("use_mkldnn") &&
1070+
platform::is_cpu_place(ctx.GetPlace());
10701071
return use_mkldnn_ctx && this->SupportsMKLDNN(data_type);
10711072
}
10721073

0 commit comments

Comments
 (0)