From b9330fe1c28bf4d95d2c03dc7cfcae14b58a4ea5 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 22 Aug 2023 16:52:32 +0800 Subject: [PATCH] add check for empty parameter desc (#56497) --- paddle/fluid/ir_adaptor/translator/program_translator.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/ir_adaptor/translator/program_translator.cc b/paddle/fluid/ir_adaptor/translator/program_translator.cc index cc076dd30ba..90655547812 100644 --- a/paddle/fluid/ir_adaptor/translator/program_translator.cc +++ b/paddle/fluid/ir_adaptor/translator/program_translator.cc @@ -145,6 +145,10 @@ void ProgramTranslator::GetParameterForSingleBlock(const BlockDesc& block) { bool need_get_parameter_op = is_parameter && is_unseen_variable; if (need_get_parameter_op) { + PADDLE_ENFORCE_NOT_NULL( + var_desc, + phi::errors::PreconditionNotMet( + "VarDesc of [%s] can not be nullptr", var_name)); ir::Operation* op = InsertGetParamaterOp(ctx_, var_desc); program_->block()->push_back(op); param_map_[var_name] = VariableDefiningInfo(op->result(0)); -- GitLab