From 0fd09fdfea1fde4d680bf9aacd0e98c714fe2c02 Mon Sep 17 00:00:00 2001 From: wawltor Date: Fri, 17 Sep 2021 11:08:49 +0800 Subject: [PATCH] fix the memory leak for the static.auc fix the memory leak for the static.auc --- paddle/fluid/operators/metrics/auc_op.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/operators/metrics/auc_op.cc b/paddle/fluid/operators/metrics/auc_op.cc index 4f2f1d0722..4ab101a627 100644 --- a/paddle/fluid/operators/metrics/auc_op.cc +++ b/paddle/fluid/operators/metrics/auc_op.cc @@ -27,6 +27,13 @@ class AucOp : public framework::OperatorWithKernel { OP_INOUT_CHECK(ctx->HasInput("Label"), "Input", "Label", "Auc"); auto predict_dims = ctx->GetInputDim("Predict"); auto label_dims = ctx->GetInputDim("Label"); + PADDLE_ENFORCE_GE( + predict_dims.size(), 2, + platform::errors::InvalidArgument( + "The Input(Predict) has not been initialized properly. The " + "shape of Input(Predict) = [%s], the shape size must be " + "greater_equal 2.", + predict_dims)); auto predict_width = predict_dims[1]; PADDLE_ENFORCE_NE( framework::product(predict_dims), 0, -- GitLab