feat(data): Add 'axis' support to gm.data.pad #501
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.
Title:
feat(data): Add 'axis' support to gm.data.padDescription
This PR implements the missing
axisargument ingm.data.pad, addressing the TODO left ingemma/gm/data/_functional.py.Previously,
gm.data.padraised aNotImplementedErrorifaxis != -1. This change enables padding along arbitrary axes, which is essential for handling multi-dimensional data pipelines in JAX (e.g., padding batch dimensions or specific feature dimensions).Changes
NotImplementedErrorguard.pad_widthconstruction logic to target the specifiedaxis.test_pad_axisregression test to verify padding onaxis=0andaxis=-2.Verification
test_pad_axis(Passed).test_pad,test_seq2seq(Passed).Related Issue
Resolves
TODO(epot): Could add an axis= kwarg to support multi-dimensional arrays.