From dfd6a62a9ab6e7b2cc35a92306217065ae87bbcf Mon Sep 17 00:00:00 2001 From: wopeizl Date: Wed, 31 Jul 2019 10:15:50 +0800 Subject: [PATCH] Optimize the error report information when loadcombine fail to open model files test=develop (#18888) --- paddle/fluid/operators/load_combine_op.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/load_combine_op.h b/paddle/fluid/operators/load_combine_op.h index 45a155af85..9f6565ddf3 100644 --- a/paddle/fluid/operators/load_combine_op.h +++ b/paddle/fluid/operators/load_combine_op.h @@ -41,10 +41,15 @@ class LoadCombineOpKernel : public framework::OpKernel { if (!model_from_memory) { std::ifstream fin(filename, std::ios::binary); PADDLE_ENFORCE(static_cast(fin), - "Cannot open file %s for load_combine op", filename); + "OP(LoadCombine) fail to open file %s, please check " + "whether the model file is complete or damaged.", + filename); LoadParamsFromBuffer(ctx, place, &fin, load_as_fp16, out_var_names); } else { - PADDLE_ENFORCE(!filename.empty(), "Cannot load file from memory"); + PADDLE_ENFORCE(!filename.empty(), + "OP(LoadCombine) fail to open file %s, please check " + "whether the model file is complete or damaged.", + filename); std::stringstream fin(filename, std::ios::in | std::ios::binary); LoadParamsFromBuffer(ctx, place, &fin, load_as_fp16, out_var_names); } -- GitLab