microsoft / microsoft/onnxruntime

[Feature Request] [web/webgpu] Support non-symmetrical padding in Conv

Open
#24,800 1 comment 0 reactions 0 assignees View on GitHub
ep:WebGPU feature request platform:web
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

ONNX runtime web with ep:webgpu currently expects padding in Conv to be totally symmetrical:

https://github.com/microsoft/onnxruntime/blob/9681fe68a660bbb44acae70d54057e1657411c0d/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv3d_naive_webgpu.ts#L125-L127

Models that need Conv with asymmetrical padding fail to run with the error shown above.

A possible workaround for users might involve factoring out the padding into a separate Pad op. This is tricky to do for models with pretrained weight however.

### Describe scenario use case

Necessary for executing any model that needs convolutions with Conv with non-symmetric padding under ONNX runtime web with ep:webgpu. One example of such a model is TransnetV2 (https://github.com/soCzech/TransNetV2).

Contributor guide

Open the contributing guide

Research direction

Start with js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv3d_naive_webgpu.ts at the referenced padding logic and trace how Conv padding is handled in the webgpu execution path. Reproduce the failure with a model using non-symmetrical padding, then verify that the TransNetV2 scenario and other such Conv models execute successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, wasm
Domain
machine-learning, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.