From c35413bf5c42fe22821c7fbb9c9ac837dfa13865 Mon Sep 17 00:00:00 2001 From: Zhaolong Xing Date: Mon, 17 Feb 2020 20:40:57 +0800 Subject: [PATCH] =?UTF-8?q?[cherry-pick]=20:Refine=20the=20error=20log=20a?= =?UTF-8?q?bout=20runtime=20batch=20and=20max=5Fbatch=E2=80=A6=20(#22537)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [cherry-pick] :Refine the error log about runtime batch and max_batch_size. #22535 test=release/1.7 * fix comments test=release/1.7 --- .../operators/tensorrt/tensorrt_engine_op.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h index 02e272ec357..0e6781aa1c9 100644 --- a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h +++ b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h @@ -269,7 +269,24 @@ class TensorRTEngineOp : public framework::OperatorBase { output_index += 1; } - PADDLE_ENFORCE_LE(runtime_batch, max_batch_size_); + PADDLE_ENFORCE_LE( + runtime_batch, max_batch_size_, + platform::errors::InvalidArgument( + "The runtime batch size (%d) is greater than the max batch " + "size(%d).\n" + "There are two possible causes for this problem: \n" + "1. Check whether the runtime batch is larger than the max_batch " + "setted by EnableTensorrtEngine()\n" + "2. Check whether the model you are running has multiple trt " + "subgraphs: \n " + "\tIf there are multiple trt subgraphs, you need to ensure that " + "the first dimension of the input tensor of these subgraphs is " + "consistent.\n" + "\tIf there are inconsistent subgraphs, you need to filter them by " + "setting min_subgraph_size using EnableTensorrtEngine interface.\n" + "\tThe min_subgraph_size shouble to be greater than the number of " + "nodes in the inconsistent subgraph.\n", + runtime_batch, max_batch_size_)); // Execute the engine. engine->Execute(runtime_batch, &buffers, stream); cudaStreamSynchronize(stream); -- GitLab