diff --git a/paddle/fluid/operators/mul_op.cc b/paddle/fluid/operators/mul_op.cc index 8d758094282f2380a50a7cbcef8de862c7a12ec6..2be2d7b548e61d0863ddfd4a12c1c3c5a6f96fd5 100644 --- a/paddle/fluid/operators/mul_op.cc +++ b/paddle/fluid/operators/mul_op.cc @@ -47,6 +47,12 @@ class MulOp : public framework::OperatorWithKernel { << " x_num_col_dims=" << x_num_col_dims << " y_num_col_dims=" << y_num_col_dims; + PADDLE_ENFORCE_NE(framework::product(y_dims), 0, + "Maybe the Input variable Y(%s) has not " + "been initialized. You may need to confirm " + "if you put exe.run(startup_program) " + "after optimizer.minimize function.", + ctx->Inputs("Y").front()); PADDLE_ENFORCE_GT(x_dims.size(), x_num_col_dims, "ShapeError: The input tensor X's dimensions of MulOp " "should be larger than x_num_col_dims. But received X's "