onnx-tensorrt icon indicating copy to clipboard operation
onnx-tensorrt copied to clipboard

[BUG] TRT parsing faile : [PAD] node -> in case of 2D input, 2D padding fail "assertion sizeKnown() failed"

Open dedoogong opened this issue 4 years ago • 4 comments

Description

When the parsing node is Pad and input tensor is 2D([2,2] shape ) and padding is [1,0,0,0] (it's for 4D) the error occurs as below;

[03/24/2021-08:18:11] [I] [TRT] Parsing node: avg_pool/SpaceToBatchND_pad__515 [Pad] [03/24/2021-08:18:11] [I] [TRT] Searching for input: avg_pool/BatchToSpaceND_cast__588:0 [03/24/2021-08:18:11] [I] [TRT] Searching for input: const__328 [03/24/2021-08:18:11] [I] [TRT] avg_pool/SpaceToBatchND_pad__515 [Pad] inputs: [avg_pool/BatchToSpaceND_cast__588:0 -> (2, 2)], [const__328 -> (4)], [03/24/2021-08:18:11] [E] [TRT] avg_pool/SpaceToBatchND_pad__515: only activation types allowed as input to this layer. sample_onnx_asl_feat_debug: /workspace/TensorRT/parsers/onnx/ShapeTensor.hpp:75: int32_t onnx2trt::ShapeTensor::size() const: Assertion `sizeKnown()' failed.

Environment

TensorRT Version: 7.2.2 ONNX-TensorRT Version / Branch: latest GPU Type: RTX 2080Ti, V100, T4 Nvidia Driver Version: 450 CUDA Version: 11.0 CUDNN Version: 8.0.1 Operating System + Version: ubuntu 18.04 Python Version (if applicable): TensorFlow + TF2ONNX Version (if applicable): PyTorch Version (if applicable): Baremetal or Container (if container which image + tag):

Relevant Files

you can get the code/onnx model here : https://github.com/dedoogong/ASLFeat_TRT

Steps To Reproduce

put all codes in the TensorRT repo folder with other plugin/samples. and build / just run the binary.

dedoogong avatar Mar 25 '21 02:03 dedoogong

I tried to insert 2 Unsqueeze and 2 Squeeze nodes before/after the pad node to make the 2D input to 4D and then recover the 4D to 2D back. but I got similar error again. [03/25/2021-08:10:48] [I] [TRT] Parsing node: avg_pool/SpaceToBatchND_pad__598 [Pad] [03/25/2021-08:10:48] [I] [TRT] Searching for input: Unsqueeze_1 [03/25/2021-08:10:48] [I] [TRT] Searching for input: const__2172 [03/25/2021-08:10:48] [I] [TRT] avg_pool/SpaceToBatchND_pad__598 [Pad] inputs: [Unsqueeze_1 -> (1, 1, 2, 2)], [const__2172 -> (4)], [03/25/2021-08:10:48] [E] [TRT] avg_pool/SpaceToBatchND_pad__598: only activation types allowed as input to this layer. [03/25/2021-08:10:48] [I] [TRT] avg_pool/SpaceToBatchND_pad__598 [Pad] outputs: [avg_pool/SpaceToBatchND_pad__598:0 -> ()], [03/25/2021-08:10:48] [I] [TRT] Parsing node: avg_pool/BatchToSpaceND_squeeze__677 [Squeeze] [03/25/2021-08:10:48] [I] [TRT] Searching for input: avg_pool/BatchToSpaceND_slice__674:0 [03/25/2021-08:10:48] [I] [TRT] avg_pool/BatchToSpaceND_squeeze__677 [Squeeze] inputs: [avg_pool/BatchToSpaceND_slice__674:0 -> (1, 2)], [03/25/2021-08:10:48] [E] [TRT] avg_pool/SpaceToBatchND_pad__598: only activation types allowed as input to this layer. [03/25/2021-08:10:48] [I] [TRT] avg_pool/BatchToSpaceND_squeeze__677 [Squeeze] outputs: [avg_pool/BatchToSpaceND_squeeze__677:0 -> ()], [03/25/2021-08:10:48] [I] [TRT] Parsing node: avg_pool/BatchToSpaceND_squeeze__675 [Squeeze] [03/25/2021-08:10:48] [I] [TRT] Searching for input: avg_pool/BatchToSpaceND_slice__673:0 [03/25/2021-08:10:48] [I] [TRT] avg_pool/BatchToSpaceND_squeeze__675 [Squeeze] inputs: [avg_pool/BatchToSpaceND_slice__673:0 -> (1, 2)], [03/25/2021-08:10:48] [E] [TRT] avg_pool/SpaceToBatchND_pad__598: only activation types allowed as input to this layer. [03/25/2021-08:10:48] [I] [TRT] avg_pool/BatchToSpaceND_squeeze__675 [Squeeze] outputs: [avg_pool/BatchToSpaceND_squeeze__675:0 -> ()], [03/25/2021-08:10:48] [I] [TRT] Parsing node: strided_slice_13__291 [Squeeze] [03/25/2021-08:10:48] [I] [TRT] Searching for input: strided_slice_13:0 [03/25/2021-08:10:48] [I] [TRT] strided_slice_13__291 [Squeeze] inputs: [strided_slice_13:0 -> (-1, -1, -1, -1, -1)], [03/25/2021-08:10:48] [E] [TRT] avg_pool/SpaceToBatchND_pad__598: only activation types allowed as input to this layer. sample_onnx_asl_feat_debug: /workspace/TensorRT/parsers/onnx/ShapeTensor.hpp:75: int32_t onnx2trt::ShapeTensor::size() const: Assertion `sizeKnown()' failed. Aborted (core dumped)

dedoogong avatar Mar 25 '21 08:03 dedoogong

the onnx file is here, aslfeatv2_op11_custom_const_padding_v3.zip I'm not sure why it fails to infer the Padded shape of 2D input and padding value of [1, 0, 0, 0]...

Please help me!

dedoogong avatar Apr 07 '21 07:04 dedoogong

Thanks for the report, looking into it.

kevinch-nv avatar Apr 17 '21 21:04 kevinch-nv

@dedoogong I've looked at your model, and in TRT we currently do not support padding of INT32 tensors. Can you try adding some cast operations before and after the pad to see if that fixes the issue?

kevinch-nv avatar May 03 '21 20:05 kevinch-nv

INT32 padding has been supported for the past few releases, closing this issue. If the issue persists, please open a new issue.

kevinch-nv avatar Mar 15 '23 23:03 kevinch-nv