Unify convolution/pooling functions for all spatial dimensionalities
See original GitHub issueI sometimes saw users that do not know the existence of ConvolutionND
and *_pooling_nd
. In particular, they say “there is no Convolution1D” (or 3D), although it is supported by the ND version. There are two approaches to resolve this issue.
- Make explicit versions for typical dimensionalities (Convolution1D, Convolution3D, …)
- Unify them and use it everywhere (Convolution, max_pooling, …)
I feel the second approach is much simpler. As for the Functions, we only have to make an alias of *_nd
without the suffix _nd
, e.g. convolution
, max_pooling
, etc. As for the Links, we have to think about how to let it know the dimensionality of the parameters. Thanks to the lazy initialization of the parameters, it can be automatically inferred in most cases, so that we can make Convolution
that can be constructed by a code like Convolution(out_size, kernel_size)
. We can also explicitly specify the spatial dimensionality by ndim
option.
Another interesting aspect of this approach is that, once we fix the existing code to use this unified version, the definition of a convnet designed for a specific spatial dimensionality (e.g., 2D) is directly reusable for other spatial dimensionalities (e.g., 1D and 3D), because there is no information about the dimensionality appearing in the model definitions.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:7 (4 by maintainers)
Top GitHub Comments
I vote for the 2nd option, to make a unified interface.
This issue is closed as announced. Feel free to re-open it if needed.