-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Enable reshape_op to support dimension inference #6609
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
Conversation
paddle/operators/reshape_op.cc
Outdated
| for (size_t i = 0; i < shape.size(); ++i) { | ||
| PADDLE_ENFORCE(shape[i] > 0 || shape[i] == -1, | ||
| "Each dimension of Attr(shape) must be positive or -1."); | ||
| if (shape[i] == -1) { |
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 define -1 as a const value like
int64_t kUnknownSize = -1for reading 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.
Done
jacquesqiao
left a comment
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.
generally LGTM
kuke
left a comment
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.
Thanks!
paddle/operators/reshape_op.cc
Outdated
| for (size_t i = 0; i < shape.size(); ++i) { | ||
| PADDLE_ENFORCE(shape[i] > 0 || shape[i] == -1, | ||
| "Each dimension of Attr(shape) must be positive or -1."); | ||
| if (shape[i] == -1) { |
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.
Done
jacquesqiao
left a comment
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!
Resolve #6608