-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix slice op shape=-1 bug #18107
Conversation
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.
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"); |
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.
should this check before line 56, and in this way maybe we don't need line 56?
|
||
step_in++; | ||
} | ||
} |
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.
how about change a way to implement this it looks weird to using an while(true)
loop
python/paddle/fluid/framework.py
Outdated
@@ -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) |
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.
delete this?
|
||
step_in++; | ||
} | ||
} |
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.
can we change a way to impl this it looks weird with a while(true)
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.
LGTM
* fix slice op bug; test=develop * fix variabel test bug; test=develop * remove slice while true; test=develop
修复slice 再遇到shape=-1情况的bug
已经增加desrease dim的功能