From a06d75a280ca56789b30d67fe35aa7ad99a1d7c1 Mon Sep 17 00:00:00 2001 From: Zhaolong Xing Date: Mon, 17 Feb 2020 20:24:29 +0800 Subject: [PATCH] [Paddle-TRT] Refine the error log about runtime batch and max_batch_size. (#22535) * fix trt log test=develop * fix comments test=develop --- .../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