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

Fix missing layouts in operators #2136

Merged
merged 17 commits into from Jul 31, 2020

Conversation

jantonguirao
Copy link
Contributor

@jantonguirao jantonguirao commented Jul 21, 2020

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

Why we need this PR?

Pick one, remove the rest

  • It fixes a missing tensor layouts in operator's outputs (few of them did not set the layout)

What happened in this PR?

Fill relevant points, put NA otherwise. Replace anything inside []

  • What solution was applied:
    SetLayout in a few operators that didn't
    Added a resize function to TensorLayout (permute didn't work properly without it)
    TensorVector::GetLayout will check the sample layouts if the layout for the whole TensorVector was not set
  • Affected modules and functionalities:
    Several operators, TensorLayout, TensorVector
  • Key points relevant for the review:
    Correctness of output layouts, Implementation of TensorLayout::resize and TensorVector::GetLayout
  • Validation and testing:
    TensorLayout::resize tests added
  • Documentation (including examples):
    N/A

JIRA TASK: [DALI-1517]

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484144]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484144]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484169]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484169]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484472]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1484472]: BUILD FAILED

@@ -66,7 +66,7 @@ void Flip<CPUBackend>::RunImpl(Workspace<CPUBackend> &ws) {
auto _horizontal = GetHorizontal(ws, ws.data_idx());
auto _vertical = GetVertical(ws, ws.data_idx());
auto _depthwise = GetDepthwise(ws, ws.data_idx());
if (!_horizontal && !_vertical) {
if (!_horizontal && !_vertical && !_depthwise) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a bonus bugfix

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines 393 to 397
if (ws.NumInput() > 0 && ws.NumOutput() > 0) {
auto &in = ws.template InputRef<GPUBackend>(0);
auto &out = ws.template OutputRef<GPUBackend>(0);
auto in_layout = in.GetLayout();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to remove

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1487706]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1487706]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1487727]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1487727]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1489879]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1489879]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1490840]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1490840]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1491086]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1491086]: BUILD FAILED

@@ -193,6 +193,15 @@ class TensorLayout {
DALI_HOST_DEV
constexpr bool empty() const noexcept { return size() == 0; }

void resize(size_t new_size, char value = '?') noexcept {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

permuting tensor layout was broken because of missing resize function

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1493265]: BUILD STARTED

@jantonguirao jantonguirao changed the title [WIP][Test only] Find empty layouts Fix missing layouts in operators Jul 24, 2020
@jantonguirao jantonguirao marked this pull request as ready for review July 24, 2020 10:41
@@ -96,6 +96,7 @@ void ColorSpaceConversion<GPUBackend>::RunImpl(DeviceWorkspace &ws) {
DALI_ENFORCE(IsType<uint8_t>(input.type()),
"Color space conversion accept only uint8 tensors");
auto &output = ws.Output<GPUBackend>(0);
output.SetLayout(input.GetLayout());
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
output.SetLayout(input.GetLayout());
output.SetLayout(InputLayout(ws, 0));

…t number of inputs

Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1500962]: BUILD STARTED

Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1501066]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1501066]: BUILD FAILED

@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1505083]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1505083]: BUILD FAILED

@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1507491]: BUILD STARTED

Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1507729]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1507729]: BUILD FAILED

Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1508081]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1508081]: BUILD PASSED

Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1508762]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1508762]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1508762]: BUILD PASSED

@jantonguirao jantonguirao merged commit 0362ac4 into NVIDIA:master Jul 31, 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.

None yet

4 participants