Open jihad-akl opened 1 year ago
Update: putting s to min_shape and max_shape it result to an error:
creating engine
/opt/conda/lib/python3.8/site-packages/torch/nn/functional.py:3728: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")
[05/05/2023-11:29:34] [TRT] [E] 3: [network.cpp::addPoolingNd::1025] Error Code 3: API Usage Error (Parameter check failed at: optimizer/api/network.cpp::addPoolingNd::1025, condition: allDimsGtEq(windowSize, 1) && volume(windowSize) < MAX_KERNEL_DIMS_PRODUCT(nbSpatialDims)
)
Traceback (most recent call last):
File "test_to_ocr_torch_tensorrt.py", line 10, in
I am facing the same issue
I converted a torch model with multiple input but it is not working
input_shape = (1, 3 , 32, 96) input_tensor = torch.ones(input_shape).cuda() print("creating engine") engine = torch2trt(self.net, [input_tensor], min_shape= [(1, 3, 32, 32)],max_shape= [(1, 3, 960, 960)],fp16_mode= True) print("engine done") torch.save(engine.state_dict(), 'model.pth')
the model is created but in inference if i give a shape other than (1, 3 , 32, 96) i get an error:
[05/05/2023-07:45:37] [TRT] [E] 3: [executionContext.cpp::setBindingDimensions::966] Error Code 3: API Usage Error (Parameter check failed at: runtime/api/executionContext.cpp::setBindingDimensions::966, condition: profileMinDims.d[i] <= dimensions.d[i]. Supplied binding dimension [1,3,32,64] for bindings[0] exceed min ~ max range at index 3, maximum dimension in profile is 96, minimum dimension in profile is 96, but supplied dimension is 64.