Skip to content

Fix dilated Conv2d/Conv3d output size calculation - #3526

Open
wei-core wants to merge 1 commit into
NVIDIA:mainfrom
wei-core:codex/fix-dilated-conv-output-size
Open

Fix dilated Conv2d/Conv3d output size calculation#3526
wei-core wants to merge 1 commit into
NVIDIA:mainfrom
wei-core:codex/fix-dilated-conv-output-size

Conversation

@wei-core

@wei-corewei-core commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • compute Conv2d P/Q from the effective dilated filter extent, (filter - 1) * dilation + 1
  • apply the same correction to Conv3d Z for both symmetric and asymmetric padding constructors
  • add regression tests for dilated 2D/3D problems, asymmetric padding and stride, and 1x1 filters

Background

The existing formula subtracts filter * dilation. It agrees with the standard convolution output-size formula only when dilation is 1. For dilation greater than 1 it undersizes the output, and a 1x1 filter is incorrectly made smaller by increasing dilation.

Contribution roles

I led the contribution direction and acceptance criteria, reviewed and approved
the final design, and reviewed every changed line. I understand the change and
own the final design decision and the submission. AI assistance was used for
repository research, root-cause analysis, implementation preparation, and
automated validation execution.

Testing

  • reproduced the bug on the unmodified main branch: 2D output 3x4 instead of 4x6, and 3D output 4x3x4 instead of 5x4x6
  • manually compiled and ran test/unit/conv/problem_size.cpp with MSVC 19.44, CUDA 12.9 headers, CCCL headers, and GoogleTest v1.14.0
  • all 5 regression tests passed

Fixes#3502

Compute each output extent from the effective dilated filter size, (filter - 1) * dilation + 1, in the Conv2d and Conv3d problem-size constructors. Add host-only regression coverage for 2D and 3D constructors, including asymmetric padding and unit filters.
Signed-off-by: WikAlie <194917782+wei-core@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conv2d/Conv3d output-size constructors use R*dilation instead of the effective filter size ((R-1)*dilation+1)

1 participant

@wei-core