From 35c8eaf583a2863235bfdd67c27e75ff77106fc6 Mon Sep 17 00:00:00 2001 From: lidanqing Date: Thu, 14 Jan 2021 13:27:24 +0100 Subject: [PATCH] [cherry-pick] correct the allowed dimension size (#30326) (#30433) --- paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc index 22954203d6..0971be6cfe 100644 --- a/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc @@ -94,8 +94,10 @@ void eltwise_forward(const framework::ExecutionContext &ctx, } PADDLE_ENFORCE( - x->dims().size() == 2 || x->dims().size() == 3 || x->dims().size() == 4, - platform::errors::Unimplemented("Input dim must be with 2, 3 or 4")); + x->dims().size() >= 1 || x->dims().size() <= 6, + platform::errors::Unimplemented("Input dimension size can be 1, 2, 3, 4, " + "5, or 6, but now the dimension size is", + x->dims().size())); auto src_tz = framework::vectorize(x->dims()); -- GitLab