Skip to content

[pull] master from google-deepmind:master - #64

Merged
pull[bot] merged 5 commits into
dumpmemory:masterfrom
google-deepmind:master
Jun 3, 2026
Merged

[pull] master from google-deepmind:master#64
pull[bot] merged 5 commits into
dumpmemory:masterfrom
google-deepmind:master

Conversation

@pull

@pull pull Bot commented Jun 3, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

claudiofantacci and others added 5 commits June 1, 2026 09:24
pad_to_size hardcoded pad_width as ((top, bottom), (left, right), (0, 0))
which assumes channels-last (HWC) layout regardless of the channel_axis
argument. For channels-first (CHW) images, this causes the padding to be
applied along the channel dimension and leaves the width dimension unpadded,
producing a wrong output shape (e.g. (5, 6, 4) instead of (3, 6, 6)).

Fix: branch on _channels_last(image, channel_axis) and produce
((0, 0), (top, bottom), (left, right)) for CHW layout, consistent
with how every other function in this module handles channel_axis.

Add pad_to_size_test.py covering:
- HWC baseline (channel_axis=-1): shape is preserved correctly.
- CHW shape (channel_axis=0): must be (C, H', W') not (C+pad, H', W).
- CHW values (channel_axis=0): original pixels centered, border is zero.
- Batched CHW (channel_axis=1): must be (B, C, H', W').
Address review feedback on PR #112:
- Move the channels-first pad_to_size regression tests out of the
  standalone pad_to_size_test.py and into the existing TestCustom class
  in augment_test.py, matching that file's conventions.
- Drop the explanatory comments, consistent with the surrounding tests.

Delete dm_pix/_src/pad_to_size_test.py.
PiperOrigin-RevId: 925269255
@pull pull Bot locked and limited conversation to collaborators Jun 3, 2026
@pull pull Bot added the ⤵️ pull label Jun 3, 2026
@pull
pull Bot merged commit e5c77ce into dumpmemory:master Jun 3, 2026
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants