[pull] master from google-deepmind:master - #64
Merged
Conversation
PiperOrigin-RevId: 924750260
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: 925200395
PiperOrigin-RevId: 925269255
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )