Answers.Body: <p>Yes, in Keras you can apply different strides by giving a <strong>tuple/list</strong>, specifying the value of strides along the height and width. If you just give a <strong>single</strong> value the API assumes the <strong>same value</strong> for <strong>all spatial dimensions</strong>.</p>
  <p>You can find the official documentation <a href="https://keras.io/api/layers/convolution_layers/convolution2d/#:%7E:text=strides%3A%20An%20integer%20or%20tuple,Specifying%20any%20stride%20value%20!%3D" rel="nofollow noreferrer">here</a></p>
  <p>In Pytorch, too you can specify the values in a tuple for the <code>stride</code>
  argument. Link to Pytorch Documentation for <a href="https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html" rel="nofollow noreferrer">stride</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-27T00:21:37.847Z
Answers.LastActivityDate: 2020-08-27T00:21:37.847Z
Answers.UserDisplayName: Saurav Maheshkar
Answers.Body: <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-26T01:35:19.113Z
Answers.LastActivityDate: 2020-08-26T01:35:19.113Z
Answers.UserDisplayName: user192361237
Body: <p>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?</p>
  <p>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).</p>
  <p>Is it possible to apply a different stride for each direction?</p>
  
Tags: <convolutional-neural-networks><convolutional-layers><stride>
Title: Is the stride applied both in the horizontal and vertical directions in convolutional neural networks?
UserDisplayName: anonuser01
ThreadText: # Is the stride applied both in the horizontal and vertical directions in convolutional neural networks?
  
  (Asked by: username_0 on 2020-08-25)
  
  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?
  
  **Tags:** convolutional-neural-networks, convolutional-layers, stride
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-08-27. Score: 4
  
  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](https://keras.io/api/layers/convolution_layers/convolution2d/#:%7E:text=strides%3A%20An%20integer%20or%20tuple,Specifying%20any%20stride%20value%20!%3D)
  
  In Pytorch, too you can specify the values in a tuple for the `stride`
  argument. Link to Pytorch Documentation for [stride](https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html)
  
  
  ---
  
  ### Answer by username_2 on 2020-08-26. Score: 3
  
  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.
  
  
  ---
  
  