4

I know what meaning stride has when it is just an integer number (by which step you should apply a filter to the image). But about (1, 1) or even more dimensional stride?

nbro
  • 39,006
  • 12
  • 98
  • 176

1 Answers1

5

Your stride will be just an integer number only when doing 1D convolution. When doing 2D convolution you get 2 integers like your example: (1, 1).

When there is more than one dimension to a stride, then each is applied independently in its associated dimension, and all valid combinations that fit in the area or volume should be calculated.

A 2D stride defines a rectangular grid of points where an operation is applied. The first number is distance between grid points along first (x) axis, the second number is distance between grid points along second (y) axis. You can decide to downsample each dimension differently by using different numbers for each dimension.

In TensorFlow is common to see 4D stride parameters, with axes of (example, height, width, channel). Typically you don't want to skip any examples or channels in a normal CNN, even though the framework can do that, so you will see values like (1, 2, 2, 1) used when using stride to downsample just image height and width dimensions between layers.

MD004
  • 107
  • 3
Neil Slater
  • 28,678
  • 3
  • 38
  • 60