-
Notifications
You must be signed in to change notification settings - Fork 3k
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
WIP [Documentation]: C# Workflow for consuming "Augmented" Onnx model with Custom Operators #11657
Comments
The c# example for testing custom operator is here. We need c# example on how to use contributed operator |
Is your feature request related to a problem? Please describe. The main build instruction page on Build ONNX Runtime from source does not provide the simplest step for building for custom op development ==> In addition to what is listed below, perhaps we need a section on Build for Custom Op development Build for inferencing |
FYI: Classes of torchvision\ops Reusability of PyTorch/OnnxExtension C++ Operatorsin ML.NET, TorchSharp, Onnxruntime and PyTorchflowchart TB
Operators\nstaticLibrary1-->Operators\nstaticLibrary2
Operators\nDynamicLibrary1-->Operators\nDynamicLibrary2
Operators\nDynamicLibrary1-->Operators\nDynamicLibrary3
subgraph ML.NET-Or-ORT
Onnx-->C#-register
C#-register-->Operators\nDynamicLibrary3
Operators\nDynamicLibrary3-->Augmented\nORT\nInference
end
subgraph ORT-Extension
Custom\nOperators\nC++-->Operators\nDynamicLibrary1
end
subgraph TorchSharp-TorchVision
C#Interop-->Operators\nstaticLibrary2
C#Interop\nRegister-->Operators\nDynamicLibrary2
Operators\nstaticLibrary2-->Augmented\nTorchSharp\nModel
Operators\nDynamicLibrary2-->Augmented\nTorchSharp\nModel
end
subgraph PyTorch-TorchVision
Operators\nC++-->Operators\nstaticLibrary1
Operators\nstaticLibrary1-->PyBind
PyBind-->Augmented\nPyTorch\nModel
end
|
If I understand correctly, most of the contributed Ops in ORT, (some of them) come from experimental Custom Ops development in ORT Extension. If these contributed Ops could be "Reversed" back to Custom Ops and made available through ORT Extension, then other projects e.g. ML.NET and TorchSharp could benefit from the Ops reusability! |
3 ways to add a new operator
Use Case: PyTorch exports a custom_op_test.onnx with TWO custom operators
custom_op_test.onnx
CSharp API for loading Shared Library with Custom Operators
Create Custom_op_library.dll
custom_op_library.h
custom_op_library.cc
In CSharp Register Custom Operators within the Shared Library: Custom_op_library.dll
CSharp UnitTest: NetCoreApp/InferenceTest.netcore.c
@natke
WIP for CSharp
[Documentation] How to register custom operator in onnxruntime
Other references:
The text was updated successfully, but these errors were encountered: