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 slice op shape=-1 bug #18107

Merged
merged 5 commits into from
Jun 20, 2019
Merged

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Jun 14, 2019

修复slice 再遇到shape=-1情况的bug
已经增加desrease dim的功能

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

some comments

start = std::min(start, dim_value);
end = std::min(end, dim_value);
start = std::min(start, end);
PADDLE_ENFORCE_GT(end, start, "end should greater than start");
Copy link
Contributor

Choose a reason for hiding this comment

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

should this check before line 56, and in this way maybe we don't need line 56?


step_in++;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

how about change a way to implement this it looks weird to using an while(true) loop

@@ -787,6 +787,7 @@ def _sliceAndConcatVar(self, item, axis):
return self._cloneVar(True)
start, stop, step = self._slice_indices(item, self.shape[axis])
if step == 1:
print("22", start)
Copy link
Contributor

Choose a reason for hiding this comment

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

delete this?


step_in++;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we change a way to impl this it looks weird with a while(true)

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

@phlrain phlrain changed the title Fix slice op bug Fix slice op shape=-1 bug Jun 20, 2019
@phlrain phlrain merged commit cefd0fb into PaddlePaddle:develop Jun 20, 2019
phlrain added a commit to phlrain/Paddle that referenced this pull request Jun 20, 2019
* fix slice op bug; test=develop

* fix variabel test bug; test=develop

* remove slice while true; test=develop
phlrain added a commit that referenced this pull request Jun 24, 2019
* fix slice op bug; test=develop

* fix variabel test bug; test=develop

* remove slice while true; test=develop
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.

2 participants