Reputation: 3693
Sometimes it may happen that the filter mask of a conv or pool layer does not fit into the input volume. For example I have a 5x5
input and a 2x2
filter mask and do not use any padding, while stride has the d value of 2
..
Using the formula:
H = 1 + (W - F + 2*P) / S
Where W is the input volume, F is the filter size, P is padding and S is stride - all one dimensional.
1 + (5 - 2)/2 = 3/2 = 2,5
What will be the used output dimensions? Will it get floored to "2" or ceiled to "3" ?
Upvotes: 4
Views: 1849
Reputation: 688
It will get floored to 2 considering caffe implementation.
Line 18 of $CAFFE_ROOT/src/caffe/layers/conv_layer.cpp
const int output_dim = (input_dim + 2 * pad_data[i] - kernel_extent)
/ stride_data[i] + 1;
Basically ,consider a filter of size SxS which is sliding on input. As it moves at the end ,it might have to face an input equal to its size or less than its size. If it is less than S ,then that part is ignored.This is how caffe implements it.
Upvotes: 3