Skip to content

Handle positive channel axes in Gaussian blur - #131

Merged
copybara-service[bot] merged 1 commit into
google-deepmind:masterfrom
sylvesterkaczmarek:fix/gaussian-blur-positive-channel-axis
Oct 24, 2026
Merged

copybara-service[bot] merged 1 commit into
google-deepmind:masterfrom
sylvesterkaczmarek:fix/gaussian-blur-positive-channel-axis

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Unbatched HWC and CHW images fail in gaussian_blur when their channel axis is given as a positive index. Adding the internal batch dimension shifts that index, so the convolution derives its feature-group count from the wrong dimension.

Advance nonnegative channel indices when inserting the batch dimension. Add regression coverage comparing values, shapes, and dtypes against independent SciPy 2D convolution for HWC/CHW, batched/unbatched inputs, positive/negative axes, SAME/VALID padding, and eager/JIT execution.

Fixes #130.

Validation:

  • Original source: 8 new cases fail and 24 controls pass.
  • Patched source: all 32 new cases pass.
  • Full package suite: 1,362 passed, 99 skipped (python -m pytest -q -n 2 dm_pix).
  • git diff --check: passes.

Tested on CPU with Python 3.12.14, JAX/jaxlib 0.11.2, SciPy 1.18.1, NumPy 2.5.3, and TensorFlow 2.21.0. GPU/TPU execution was not run.

Shift nonnegative channel indices when adding the internal batch dimension so unbatched HWC and CHW inputs use the correct convolution groups. Add independent SciPy reference coverage for layouts, axis forms, padding, and eager/JIT execution.

Fixes google-deepmind#130

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@claudiofantacci claudiofantacci self-assigned this Oct 4, 2026

@claudiofantacci claudiofantacci left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@claudiofantacci claudiofantacci added the enhancement New feature or request label Oct 24, 2026
@copybara-service
copybara-service Bot merged commit ad33319 into google-deepmind:master Oct 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gaussian_blur rejects positive channel axes on unbatched images

2 participants