4
$\begingroup$

In the convolutional layer for CNNs, when you specify the stride of a filter, typical notes show some examples of this but only for the horizontal panning. Is this same stride applied for the vertical direction too when you're done with the current row?

In other words, say our input volume is 7x7, and we apply a stride of 1 for a 3x3 filter. Is the output volume 5x5? (which would mean you applied the stride in both the horizontal and vertical panning).

Is it possible to apply a different stride for each direction?

$\endgroup$

2 Answers 2

4
$\begingroup$

Yes, in Keras you can apply different strides by giving a tuple/list, specifying the value of strides along the height and width. If you just give a single value the API assumes the same value for all spatial dimensions.

You can find the official documentation here

In Pytorch, too you can specify the values in a tuple for the stride argument. Link to Pytorch Documentation for stride

$\endgroup$
3
$\begingroup$

Yes, in Keras this is simply implemented by using a tuple for the stride argument of a convolutional layer, with each element of the tuple corresponding to the stride of each dimension.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .