Commit 163f614
authored
[CPU/CUDA EP] Add DeformConv op support (#27393)
### Description
<!-- Describe your changes. -->
This change adds support for the Deformable Convolution 2D operator
(DeformConv2D) to ONNX Runtime. The branch implements the operator
schema and registration, provides kernel implementations (CPU and
GPU/CUDA where available), implements shape inference, and adds unit and
integration tests to validate correctness and numerical parity with
reference implementations. The changes include performance-oriented
optimizations and necessary changes to build/test scripts.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Deformable convolutions are widely used in vision models that require
spatial sampling flexibility (e.g., Deformable ConvNets, some
detection/segmentation models). Native support in ONNX Runtime enables
these models to run efficiently without custom operators or external
runtimes, broadening the set of compatible models and improving
performance and portability.
### See also
- https://onnx.ai/onnx/operators/onnx__DeformConv.html
-
https://docs.pytorch.org/vision/main/generated/torchvision.ops.deform_conv2d.html
- https://arxiv.org/abs/1811.11168
- https://arxiv.org/abs/1703.06211
-
https://github.com/pytorch/vision/blob/0f6d91d9fe514e6de2f5519114cbeb389d498b2d/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu
-
https://github.com/open-mmlab/mmdetection/blob/master/mmdet/ops/dcn/src/deform_conv_cuda.cpp
-
https://github.com/pytorch/vision/blob/0f6d91d9fe514e6de2f5519114cbeb389d498b2d/torchvision/csrc/ops/cpu/deform_conv2d_kernel.cpp
-
https://github.com/open-mmlab/mmdetection/blob/master/mmdet/ops/dcn/src/deform_conv_cuda.cpp
- #22060
- #15572
- #20810
- #16903
- onnx/onnx#5451
- ZhengPeng7/BiRefNet#167
- pytorch/pytorch#68910
- pytorch/vision#20661 parent 727256f commit 163f614
16 files changed
Lines changed: 2834 additions & 0 deletions
File tree
- docs
- onnxruntime
- core/providers
- cpu
- nn
- cuda
- nn
- test
- providers/cpu/nn
- testdata
- nn
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
| 702 | + | |
| 703 | + | |
700 | 704 | | |
701 | 705 | | |
702 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
| 1223 | + | |
| 1224 | + | |
1223 | 1225 | | |
1224 | 1226 | | |
1225 | 1227 | | |
| |||
1316 | 1318 | | |
1317 | 1319 | | |
1318 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
1319 | 1323 | | |
1320 | 1324 | | |
1321 | 1325 | | |
| |||
3277 | 3281 | | |
3278 | 3282 | | |
3279 | 3283 | | |
| 3284 | + | |
| 3285 | + | |
3280 | 3286 | | |
3281 | 3287 | | |
3282 | 3288 | | |
| |||
3407 | 3413 | | |
3408 | 3414 | | |
3409 | 3415 | | |
| 3416 | + | |
| 3417 | + | |
3410 | 3418 | | |
3411 | 3419 | | |
3412 | 3420 | | |
| |||
0 commit comments