Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add a converter for custom operateion written by c++ #24

Open
deemoo-wang opened this issue Sep 17, 2021 · 1 comment
Open

how to add a converter for custom operateion written by c++ #24

deemoo-wang opened this issue Sep 17, 2021 · 1 comment

Comments

@deemoo-wang
Copy link

the model i used has some opration written by c++, using torch.utils.cpp_extention with a .cpp file. I want to convert the model into trt model but failed with the error NVALID_ARGUMENT: Cannot find binding of given name: input_0.
how can i write a converter for the operation written by c++?

@grimoire
Copy link
Owner

  • First, you need to implement the custom ops you need as a TensorRT plugin, here are some examples.
  • After you have your plugin, add a creator in torch2trt_dynamic/plugins, note that if you did not implement your plugin inside amirstan_plugin, you need to load library ctypes.CDLL('xxxxx.so')
  • Finally, add your convertor in torch2trt_dynamic/converters. You can read cummax.py as an example.

Note that since there are some limits on TensorRT, I can not promise that your custom ops can be implemented as a TensorRT plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants