diff --git a/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc index 22954203d6b417698eb2e9f334cddf1dc3a6c575..0971be6cfef4ffcc56c706bbc0256a11458c7585 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());