Skip to content

Add torchvision.ops.deform_conv2d and opset19-specific tests#2923

Open
f-fuchs wants to merge 1 commit into
microsoft:mainfrom
f-fuchs:torchvision_deform_conv2d
Open

Add torchvision.ops.deform_conv2d and opset19-specific tests#2923
f-fuchs wants to merge 1 commit into
microsoft:mainfrom
f-fuchs:torchvision_deform_conv2d

Conversation

@f-fuchs
Copy link
Copy Markdown

@f-fuchs f-fuchs commented May 28, 2026

Summary

Add mapping for torchvision.ops.deform_conv2d to ONNX DeformConv and add OpInfo-based test coverage.

Changes

  • add torchvision.ops.deform_conv2d support in onnxscript/function_libs/torch_lib/ops/vision.py
  • map PyTorch padding to ONNX pads
  • infer and set group and offset_group
  • support optional bias and mask

Tests

Added OpInfo coverage for:

  • basic case
  • bias
  • mask
  • nonzero padding
  • grouped convolution
  • multiple offset groups

Files:

  • tests/function_libs/torch_lib/extra_opinfo.py
  • tests/function_libs/torch_lib/ops_test_data.py

Opset handling

DeformConv requires ONNX opset 19+, while the existing torch-lib full-graph suite uses opset 18.

To keep the existing suite unchanged:

  • keep the global torch-lib test baseline at opset 18
  • add a dedicated deform-conv full-graph test path at opset 19
  • exclude deform-conv from the generic opset-18 full-graph suite

Files:

  • tests/function_libs/torch_lib/ops_test.py
  • tests/function_libs/torch_lib/ops_test_common.py

Validation

python -m pytest tests/function_libs/torch_lib/ops_test.py -k deform_conv2d

Passed:

  • 1 passed
  • 1 skipped (expected for trace_only=True)

@f-fuchs
Copy link
Copy Markdown
Author

f-fuchs commented May 28, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant