Skip to content

Commit c35413b

Browse files
authored
[cherry-pick] :Refine the error log about runtime batch and max_batch… (#22537)
* [cherry-pick] :Refine the error log about runtime batch and max_batch_size. #22535 test=release/1.7 * fix comments test=release/1.7
1 parent 189ac02 commit c35413b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

paddle/fluid/operators/tensorrt/tensorrt_engine_op.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,24 @@ class TensorRTEngineOp : public framework::OperatorBase {
269269
output_index += 1;
270270
}
271271

272-
PADDLE_ENFORCE_LE(runtime_batch, max_batch_size_);
272+
PADDLE_ENFORCE_LE(
273+
runtime_batch, max_batch_size_,
274+
platform::errors::InvalidArgument(
275+
"The runtime batch size (%d) is greater than the max batch "
276+
"size(%d).\n"
277+
"There are two possible causes for this problem: \n"
278+
"1. Check whether the runtime batch is larger than the max_batch "
279+
"setted by EnableTensorrtEngine()\n"
280+
"2. Check whether the model you are running has multiple trt "
281+
"subgraphs: \n "
282+
"\tIf there are multiple trt subgraphs, you need to ensure that "
283+
"the first dimension of the input tensor of these subgraphs is "
284+
"consistent.\n"
285+
"\tIf there are inconsistent subgraphs, you need to filter them by "
286+
"setting min_subgraph_size using EnableTensorrtEngine interface.\n"
287+
"\tThe min_subgraph_size shouble to be greater than the number of "
288+
"nodes in the inconsistent subgraph.\n",
289+
runtime_batch, max_batch_size_));
273290
// Execute the engine.
274291
engine->Execute(runtime_batch, &buffers, stream);
275292
cudaStreamSynchronize(stream);

0 commit comments

Comments
 (0)