From 674aa06114387d4e61d3c622ee7f638b11640c49 Mon Sep 17 00:00:00 2001 From: Wilber Date: Fri, 6 Mar 2020 12:17:01 +0800 Subject: [PATCH] fix concat mkldnn in extream condition. test=develop test=release/1.7 (#22877) --- paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc index 91e9d7bbaf..436bbdc553 100644 --- a/paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc @@ -142,9 +142,12 @@ class ConcatMKLDNNOpKernel : public paddle::framework::OpKernel { paddle::framework::ToMKLDNNDataType(multi_input[0]->type()); ConcatPrimitiveFactory prim_creator; + // If one of the multiple inputs of concat has an input size of 0, the + // actual size of the multi_input will change std::string key = platform::CreateKey( paddle::framework::vectorize(multi_input[0]->dims()), - ctx.OutputName("Out"), dt, platform::ThreadIDasStr()); + multi_input.size(), ctx.OutputName("Out"), dt, + platform::ThreadIDasStr()); const std::string key_prim = key + "@concat_p"; const std::string key_concat_pd = key + "@concat_pd"; -- GitLab