-
Notifications
You must be signed in to change notification settings - Fork 174
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
SpatialAveragePadding padding and ceil kernels #134
Conversation
} | ||
if(COUNT_INCLUDE_PAD) |
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.
I think this condition is inverted. When you include the padding region, you should divide by pool_size
.
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.
Actually, as is both conditions are the same. I think you should replace the ((hend - hstart) * (wend - wstart))
by kernel_h*kernel_w
.
I made some inline coments. Could you add some tests for the new cases ? |
Tests are missing test for |
Ah :-) Right :-) |
Hmmm, it looks like this compares with the cpu version? Does that mean there is a cpu implementation of ceil average pooling to compare with? |
@hughperkins yes, there is a CPU implementation, check torch/nn#365 |
(Note that I'm comparing it against my fork, with the corrections mentioned in this PR e040398 ) |
(ported to clnn, in branch, https://github.com/hughperkins/clnn/compare/master...avgpool?expand=1 ; pending merge of torch/nn#365 ) |
I think that after https://github.com/szagoruyko/cunn/pull/2 is merged, this is fine to go. |
Looks like this is ready to be merged right? :-) |
@hughperkins @szagoruyko was comparing this implementation against |
Can we at least merge in the |
The thing is, both |
Ok... I think for my own usage I'm not using setCountExcludePad. Perhaps we could split this PR into two: one for ceilmode, and one for setCountExcludePad? An easy way to do that could be to just add an |
Hum, yeah, splitting the PR is a possibility... I'll have a look at it today when I have some time. |
this PR is almost ready to be merged, the only problem is the difference between it and COUNT_EXCLUDE_PADDING mode of cudnn, which we believe to be a bug in cudnn. will update as soon we find out more. |
@szagoruyko Mmmkay. What if ... can we add something like |
|
||
luaL_argcheck(L, nInputCols >= kW && nInputRows >= kH, 2, "input image smaller than kernel size"); | ||
luaL_argcheck(L, nInputCols >= kW - padW && nInputRows >= kH - padH, 2, "input image smaller than kernel size"); |
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.
I think this should be nInputCols >= kW - 2 * padW
, and the same thing for H
.
Currently, this condition doesn't allow the case of 1x1
input to be used with kW=kH=3
and padW=padH=1
(which I think should be valid).
fixed Francisco's comments and squashed |
SpatialAveragePadding padding and ceil kernels
Thanks Sergey. |
cuda part for torch/nn#365