From 056a2fca695b6b5ed9fb278aead51942b9ae3bfb Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 28 Apr 2021 22:25:09 +0800 Subject: [PATCH] conservative judgment (#32619) --- paddle/fluid/inference/tensorrt/convert/elementwise_op.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc b/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc index 5419933e407..19d79510547 100644 --- a/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc @@ -25,6 +25,10 @@ static bool CheckDims(const nvinfer1::Dims& dims_x, return false; } for (int i = 0; i < dims_x.nbDims; i++) { + // conservative judgment + if (dims_x.d[i] == -1 || dims_y.d[i] == -1) { + return false; + } if (dims_x.d[i] != dims_y.d[i]) { return false; } -- GitLab