From 1d535ec663752ee29b8a0910c9709defdf00598f Mon Sep 17 00:00:00 2001 From: Dong Xu Date: Fri, 2 Aug 2024 16:21:42 +0800 Subject: [PATCH] [TRT] Fix TRT PadV2 LayerBuilder empty param->pads bug --- .../network/tensorrt/layer_builder/pad_v2_layer_builder.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/tnn/network/tensorrt/layer_builder/pad_v2_layer_builder.cc b/source/tnn/network/tensorrt/layer_builder/pad_v2_layer_builder.cc index 0905f6084..dbb3044fa 100644 --- a/source/tnn/network/tensorrt/layer_builder/pad_v2_layer_builder.cc +++ b/source/tnn/network/tensorrt/layer_builder/pad_v2_layer_builder.cc @@ -69,6 +69,10 @@ nvinfer1::DataType PadV2TRTPluginLayerBuilder::getOutputDataType(int index, cons ILayer* PadV2TRTPluginLayerBuilder::AddToNetwork(INetworkDefinition* network) noexcept { auto paramlist = dynamic_cast(param_); + if (paramlist->pads.empty()) { + LOGE("Error: PadV2 Layer got Empty params->pads.\n"); + return nullptr; + } if (!UseTRTPaddingND(paramlist)) { return TensorRTPluginLayerBuilder::AddToNetwork(network);