|
Theano's documentation mentions only convolution with two possible border modes: 'valid' or 'full'. Why Theano doesn't support convolution with border mode 'same'? |
|
I don't know why the keyword argument is not supported, but it's very easy to implement by performing a full convolution and then slicing the result. If L is the data length and F is the filter length, the result will have length L + F - 1, so result[(F - 1) / 2:(F - 1) / 2 + L] is what you want. Yes, I mean I don't have problems with implementing the convolution with 'same' border_mode. I am curious why Theano team didn't implement it. I am also wondering if there is any computational penalty in doing it like you have proposed.
(Sep 04 '13 at 03:38)
Mateusz Malinowski
Technically you're doing some unnecessary computations for the border parts that you cut off afterwards. You could further reduce this by padding the data manually with the right number of zeros first and then performing a valid convolution, but in practice I don't think it will make a big difference, provided that the axis (axes) over which you're convolving is long enough compared to the filter length. This should be the case for most sensible convolutions. Zero padding can also be a relatively slow operation in Theano on the GPU, since it requires all the data to be copied. As for the authors' motivations not to implement border_mode='same', you'll have to ask them :) They are very active on the theano-users mailing list.
(Sep 05 '13 at 09:28)
Sander Dieleman
The reason is simple, we didn't needed it, so we didn't spent time on it.
(Jun 27 '14 at 10:44)
Nouiz
|