originrose / cortex

Machine learning in Clojure
Eclipse Public License 1.0
1.27k stars 111 forks source link

How to specify padding type? #250

Open cassc opened 7 years ago

cassc commented 7 years ago

How to specify SAME/VALID padding with cortex.nn.layers/convolutional similar to conv2d in tensorflow

Thanks for you great work!

cnuernber commented 6 years ago

Currently you can only specify the exact padding amount. So same padding for a kernel size of 3 is 1, not sure what valid means in this context.

We would have to add this feature in order to allow this; I would be in favor for sure but we need to know the exact math in both the even and odd kernel dimension cases.

maxc01 commented 6 years ago

In TF, VALID padding means one should "specify the exact padding amount". From my point of view, it is not necessary to implement SAME padding from an API level, because one can always compute the padding to ensure the same spatial size not that difficult. For computing padding, A guide to convolution arithmetic for deep learning [1] is a great reference.

[1] https://arxiv.org/abs/1603.07285

cnuernber commented 6 years ago

Thanks, that is indeed a great reference!

All of our kernel/padding specifications are completely manual at this point so I guess we default to 'valid'.

Again, thanks for the paper I agree completely that it is a great reference and it includes some description of various deconv techniques which are always interesting.