NVIDIA-AI-IOT / torch2trt

An easy to use PyTorch to TensorRT converter
MIT License
4.58k stars 675 forks source link

torch2trt.torch2trt() error #857

Open avdvg opened 1 year ago

avdvg commented 1 year ago

Hello, dear developer. I used jetson xavier nx, ubuntu 18.04, cuda 10.2, tensorRT 8.0.1.6, jetpack 4.6, to compile the model, and I found the following error, which caused the model conversion to fail. Looking forward to your reply !

some error: [TensorRT] ERROR: 3: (Unnamed Layer* 3) [Convolution]:kernel weights has count 288 but 9216 was expected [TensorRT] ERROR: 4: (Unnamed Layer* 3) [Convolution]: count of 288 weights in kernel, but kernel dimensions (3,3) with 32 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 32 * 3*3 * 32 / 1 = 9216 [TensorRT] ERROR: 4: [convolutionNode.cpp::computeOutputExtents::28] Error Code 4: Internal Error ((Unnamed Layer* 3) [Convolution]: number of kernel weights does not match tensor dimensions) [TensorRT] ERROR: 3: (Unnamed Layer* 3) [Convolution]:kernel weights has count 288 but 9216 was expected [TensorRT] ERROR: 4: (Unnamed Layer* 3) [Convolution]: count of 288 weights in kernel, but kernel dimensions (3,3) with 32 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 32 * 3*3 * 32 / 1 = 9216 [TensorRT] ERROR: 4: [convolutionNode.cpp::computeOutputExtents::28] Error Code 4: Internal Error ((Unnamed Layer* 3) [Convolution]: number of kernel weights does not match tensor dimensions) [TensorRT] ERROR: 3: (Unnamed Layer* 3) [Convolution]:kernel weights has count 288 but 9216 was expected [TensorRT] ERROR: 4: (Unnamed Layer* 3) [Convolution]: count of 288 weights in kernel, but kernel dimensions (3,3) with 32 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 32 * 3*3 * 32 / 1 = 9216 [TensorRT] ERROR: 4: [convolutionNode.cpp::computeOutputExtents::28] Error Code 4: Internal Error ((Unnamed Layer* 3) [Convolution]: number of kernel weights does not match tensor dimensions) [TensorRT] ERROR: 2: [helpers.cpp::getHW::35] Error Code 2: Internal Error (Assertion d.nbDims >= 2 failed.) [TensorRT] ERROR: 3: (Unnamed Layer* 9) [Convolution]:kernel weights has count 576 but 36864 was expected

jaybdub commented 1 year ago

Hi @avdg,

I've witnessed similar errors when using models with grouped / depthwise convolutions.

That said, from my experience the model still builds and the output matches.

Are you using a model with depthwise / grouped convolutions? Does the model build in your case?

Best, John