Error converting F.grid_sample to TensorRT engine

Description

I have a pytorch python network which makes use of the layer torch.nn.functional.grid_sample.

I export this network to onnx using opset_version=16.

torch.onnx.export(model.module, args=(imageIn), f=PATH_OUTPUT_ONNX, input_names=['inputImage'], output_names=['out1'], export_params=True, opset_version=16)

I can sanitise it successfully (using polygraphy surgeon). However after trying to convert it to tensorrt engine I get the error:

[12/07/2022-11:59:18] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:4890 In function importFallbackPluginImporter: [8] Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace correct?"

I was able to locate the error at the F.grid_sample layer. What can I do to fix it please?

Environment

TensorRT Version: 8.5.1
GPU Type: RTX 3080
Nvidia Driver Version:
CUDA Version: 11.6
CUDNN Version:
Operating System + Version: Win 10
Python Version (if applicable): 3.10.8
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.12.1
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Hi,
Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:

  1. validating your model with the below snippet

check_model.py

import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
onnx.checker.check_model(model).
2) Try running your model with trtexec command.

In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging
Thanks!

1 Like

Thank you very much.

Here is my onnx model:
model.onnx (13.5 MB)

I sanitise it using the command:
python polygraphy surgeon sanitize --fold-constants ./model.onnx -o ./model_san.onnx

This is the sanitised result:
model_san.onnx (30.7 MB)

To convert it to tensorrt I use:
trtexec.exe --onnx=model_san.onnx --saveEngine=engine.trt

Here is the --verbose output:
verbose.txt (655.3 KB)

Hi,

We couldn’t reproduce the same error on latest TensorRT version 8.5.1.

&&&& PASSED TensorRT.trtexec [TensorRT v8501] # trtexec --onnx=model_san.onnx --verbose --memPoolSize=workspace:20000

Thank you.

1 Like

Did you run it on ubuntu?

It seems like it runs without problems on ubuntu, but not on Windows. The same issue happened before with another function in a previous version…

Hi,

Sorry for the delayed response.

Yes.
Could you ask please attach a debug tool (usually we can use visual studio “attach process” function, to check all the loaded dlls in an running prcess) and check all the loaded dlls on windows.
We want to make sure TensorRT with the correct version is loaded.

Previous we have seen some Windows users have multiple TRT and load the old library.

Thank you.