How do we get ort to support a custom ONNX operator? #151
-
The page here: https://github.com/onnx/tutorials/tree/main/PyTorchCustomOperator outlines how to: (1) design a new PyTorch operator What's the easiest way to do (3), but using this library (i.e., ort for Rust)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can achieve this by writing a custom operator library with the C++ API. See onnxruntime-extensions for an example of how this is done. To then load the custom operator library in [dependencies]
ort = { version = "2.0.0-rc.0", features = [ "custom-ops" ] } In your code, register your custom operator's library on the let session = Session::builder()?
.with_custom_ops_lib("my_ops_lib")?
.with_model_from_file("example.onnx")?; |
Beta Was this translation helpful? Give feedback.
You can achieve this by writing a custom operator library with the C++ API. See onnxruntime-extensions for an example of how this is done.
To then load the custom operator library in
ort
, enableort
'scustom-ops
feature:In your code, register your custom operator's library on the
SessionBuilder
: