TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

How use TensorRT API to add conv1d layers?

Open oreo-lp opened this issue 3 years ago • 3 comments

Description

I want to use TensorRT API to rebuild a model, which contains some conv1d layers [use torch.Conv1d()]. Inputs shape is [1,1,82000], and the output of conv1d is [1,512,16399], kernel_size = 10, stride = 5, padding = 0. Some code is below: auto conv = newtork->addConvolutionNd(input, 512, DimsHW{10, 1}, weight, bias); conv->setStrideNd(DimsHW{5,1 }); But it failed. The error is below: [graphShapeAnalyzer.cpp::addVolumeCheck::610] Error Code 9: Internal Error (output: dimension 1 never exceeds -1) Error Code 4: Internal Error (Could not compute dimensions for output, because the network is not valid.) How use addConvolutionNd() to add conv layer to network?

oreo-lp avatar Sep 02 '22 07:09 oreo-lp

@nvpohanh ^ ^

zerollzeng avatar Sep 04 '22 02:09 zerollzeng

Description

I want to use TensorRT API to rebuild a model, which contains some conv1d layers [use torch.Conv1d()]. Inputs shape is [1,1,82000], and the output of conv1d is [1,512,16399], kernel_size = 10, stride = 5, padding = 0. Some code is below: auto conv = newtork->addConvolutionNd(input, 512, DimsHW{10, 1}, weight, bias); conv->setStrideNd(DimsHW{5,1 }); But it failed. The error is below: [graphShapeAnalyzer.cpp::addVolumeCheck::610] Error Code 9: Internal Error (output: dimension 1 never exceeds -1) Error Code 4: Internal Error (Could not compute dimensions for output, because the network is not valid.) How use addConvolutionNd() to add conv layer to network?

I also had the same problem

zhudongwork avatar Sep 14 '22 08:09 zhudongwork

Inputs shape

try to reshape the input to [1,1,82000, 1], the inputshape of the addConvolutionNd should be a dims4 itensor

zhudongwork avatar Sep 14 '22 09:09 zhudongwork

TRT doesn't support 1D-Conv yet. You need to first unsqueeze the tensor, add it as a 2D conv, and then squeeze the tensor

nvpohanh avatar Dec 02 '22 09:12 nvpohanh

Closing since no activity for more than 3 weeks, please reopen if you still have question, thanks!

ttyio avatar Jan 10 '23 02:01 ttyio