-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow align-only behavior in Pad operator by treating shape argument as minimum shape #1764
Conversation
…as minimum shape Signed-off-by: Joaquin Anton <janton@nvidia.com>
!build |
CI MESSAGE: [1149863]: BUILD STARTED |
CI MESSAGE: [1149863]: BUILD PASSED |
dali/operators/generic/pad.cc
Outdated
R"code(The extents of the output shape in the axes specified by *axes* or *axis_names*. | ||
Specifying -1 for an axis restores the default behavior of extending the axis to accommodate the | ||
(aligned) size of the largest sample in the batch. If the provided extent is smaller than the one | ||
of the sample, no padding will be applied.)code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of the sample, no padding will be applied.)code", | |
of the sample, no padding will be applied (except what is needed to match required alignment).)code", |
Could you add in the PR description what was the behavior before (or even give some simple example)? |
Signed-off-by: Joaquin Anton <janton@nvidia.com>
Done |
!build |
CI MESSAGE: [1151929]: BUILD STARTED |
CI MESSAGE: [1151929]: BUILD PASSED |
Signed-off-by: Joaquin Anton janton@nvidia.com
Why we need this PR?
Pick one, remove the rest
Example:
input shape: [ 4x5, 5x11 ]
axes [1]
align [3]
Old behavior output shape [ 4x12, 5x12 ]
New behavior output shape [4x6, 5x12]
What happened in this PR?
Fill relevant points, put NA otherwise. Replace anything inside []
What solution was applied:
Changed the meaning of the
shape
argument to be interpreted as minimum shape. That is, if a given sample has a larger shape than the one specified by this argument, no padding shall be applied to that sample. The user can then use shape=(1,) and align=(4,) to achieve per sample alignment without the need to pad all samples to match the shape of the largestAffected modules and functionalities:
Pad operator
Key points relevant for the review:
Pad operator logic and tests
Validation and testing:
Test adjusted, new test case added
Documentation (including examples):
Adjusted documentation of the operator
JIRA TASK: [Use DALI-1280]