Conversation
…structor arguments
…. Renamed frame* to filter* for more standardized conventions
|
Can one of the admins verify this patch? |
|
@phsft-bot build! |
|
Starting build on |
|
Build failed on fedora28/native. Warnings:
And 174 more Failing tests:
And 93 more |
|
Build failed on centos7/gcc7. Warnings:
And 32 more Failing tests: |
|
Build failed on centos7/gcc7. Warnings:
And 14 more Failing tests: |
|
Build failed on slc6-i686/gcc49. Warnings:
And 14 more Failing tests: |
|
@phsft-bot build it and to it quick-like! |
|
Starting build on |
|
Build failed on slc6/gcc62. Warnings:
And 14 more Failing tests: |
|
Build failed on centos7/gcc7. Warnings:
And 32 more Failing tests: |
|
Build failed on slc6-i686/gcc49. Warnings:
And 14 more Failing tests: |
| bool inline isInteger(Scalar_t x) const { return x == floor(x); } | ||
|
|
||
| /* Calculate the output dimension of the convolutional layer */ | ||
| size_t calculateDimension(int imgDim, int fltDim, int padding, int stride); |
There was a problem hiding this comment.
for consistency it is maybe better to have the parameters defined as size_t
There was a problem hiding this comment.
You are right I will make the change ASAP
| Scalar_t fDropoutProbability; ///< Probability that an input is active. | ||
|
|
||
| private: | ||
| size_t fPaddingHeight; ///< The number of zero layers added top and bottom of the input. |
There was a problem hiding this comment.
why now fFilterDepdth, height are now protected and the paddingheight is private ?
There was a problem hiding this comment.
Everything that is needed on MaxPoolingLayer (which is now a subclass of ConvLayer) is now protected to reduce duplication. Since pooling uses 0 padding by definition, this field remains private to ConvLayer
| for (size_t i = 0; i < outputNSlices; i++) { | ||
| fDerivatives.emplace_back(outputNRows, outputNCols); | ||
| for (size_t i = 0; i < batchSize; i++) { | ||
| fDerivatives.emplace_back(depth, fNLocalViews); |
There was a problem hiding this comment.
We should have a comment here explaining the meaning of the variables, (i.e. that batchsize is the outputnslices, etc...)
There was a problem hiding this comment.
I would also request that explanations for e.g. depth is provided. What is called depth here is called "number of units" in some literature and "number of channels" in some. Tying our naming convention into what others are using will help people absorb the code quicker!
There was a problem hiding this comment.
Both valid points, i will address them and update the PR
|
Hi Manos, |
|
Hi Lorenzo, |
|
We try to avoid merge commits inside PRs, please use rebase instead. Thanks. |
|
Good point @pcanal thanks! Should I start doing that in other PRs or somehow change the current one as well? |
|
Could you change the current one? (It can't be brought into the master with a merge commit :) ). |
|
Yes I will do that.
I will open a new PR with a cleaner history altogether. I know its suboptimal because we will lose the current code review discussion but I want to be sure that the history is clean before merging. I have also taken notes of all the points raised here. |
|
Opened a new PR with simplified history here. All comments have been addressed. Closing this one. |
API Redesign
Goal
The goal is this PR is to improve the API of the CNN layers (MaxPooling and Conv currently), by eliminating redundant constructor arguments and fields. By redundant in this context, I refer to arguments that can be directly computed from others, and fields that unnecesseraly exist in multiple classes.
Key points
Below some discussion points on design decisions I made, but still consider debatable.
Since my experience in production level C++ is very limited I highly value opinions from experienced colleagues and previous authors of the module.
Making
MaxPoolingLayera sub-class ofConvLayerEvery layer type in a convolutional network follows the logic existing in our
ConvLayer:A filter is sliding over the input and at each step applies an operation to the input elements within its receptive field to produce a single output element.
As we can see they all share the same logic and therefore fields.
Results
Common fields between the 2 layer types in the CNN module are now not duplicated (strides sizes, padding sizes, filter sizes). The same for the 4
protectedmethods inConvLayer.We now have a cleaner API, as the constructor arguments where reduced from 26 to 16 without any change in the functionality).