Skip to content
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

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

jantonguirao
Copy link
Contributor

@jantonguirao jantonguirao commented Feb 25, 2020

Signed-off-by: Joaquin Anton janton@nvidia.com

Why we need this PR?

Pick one, remove the rest

  • It adds new feature needed to allow Pad operator to pad each sample independently to match a specified alignment configuration without having to pad all the samples to the same shape

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 largest

  • Affected 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]

…as minimum shape

Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao jantonguirao requested review from mzient and a team February 25, 2020 16:10
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1149863]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1149863]: BUILD PASSED

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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",

@JanuszL
Copy link
Contributor

JanuszL commented Feb 25, 2020

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>
@jantonguirao
Copy link
Contributor Author

Could you add in the PR description what was the behavior before (or even give some simple example)?

Done

@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1151929]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1151929]: BUILD PASSED

@jantonguirao jantonguirao merged commit 3b2b02f into NVIDIA:master Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants