Repository with guides to enable some layers from PyTorch in Intel OpenVINO:
- nn.MaxUnpool2d
- torch.fft
- nn.functional.grid_sample
- torchvision.ops.DeformConv2d
- SparseConv from Open3D
To create OpenVINO IR, use extra --extension
flag to specify a path to Model Optimizer extensions that perform graph transformations and register custom layers.
mo --input_model model.onnx --extension openvino_pytorch_layers/mo_extensions
You also need to build CPU extensions library which actually has C++ layers implementations:
source /opt/intel/openvino_2022/setupvars.sh
cd user_ie_extensions
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release && make -j$(nproc --all)
Add compiled extensions library to your project:
from openvino.runtime import Core
core = Core()
core.add_extension('user_ie_extensions/build/libuser_cpu_extension.so')
model = ie.read_model('model.xml')
compiled_model = ie.compile_model(model, 'CPU')