-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Migrate thnn_conv2d from THC to ATen #63428
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
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit d525b31 (more details on the Dr. CI page):
🕵️ 3 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
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.
This looks great @peterbell10, I left a few comments.
| } | ||
|
|
||
| // Allow for empty batch size but not other dimensions | ||
| const bool valid_empty = c10::multiply_integers(in_sizes.slice(1)) != 0; |
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.
This is not right if ndim is 3 (the you need in_sizes.numel() > 0)? Btw, do we still allow 3d inputs, or is this code path never exercised?
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.
You're right, _convolution enforce the shape check before this is ever called. Should I just remove all the dim=3 handling 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.
Yes, please do
| if (weight.defined()) { | ||
| const auto w_sizes = weight.sizes(); | ||
| int64_t nInputPlane = w_sizes[1]; | ||
| if (w_sizes.size() == 2) { |
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 this happen? I though weight shape is checked to have 4 dims before dispatching to slow conv?
| int64_t k_ = 1; | ||
|
|
||
| // Do GEMM (note: this is a bit confusing because gemm assumes column-major matrices) | ||
| if (bias.defined()) { |
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.
is it just expanding bias to output size? Should we be able to do the same with .expand() and output_n.copy_, without gemm call and ones?
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.
Is it alright if I leave algorithmic changes to a follow-up PR?
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.
sure! Then I only have questions about 3d inputs and 2d weights.
| } | ||
|
|
||
| // Do Bias: | ||
| if (grad_bias.defined()) { |
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.
This also should be doable by just a sum call with appropriate dimensions?
|
@ngimel has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Stack from ghstack:
Closes gh-24644, closes gh-24645
Differential Revision: D30441307