1
conv2d( input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)
strides=[b,h,w,c]

I know b means batch, h means height, w means width and c means channel. I see that b and c are always 1. What does it mean if b = 2 or c = 2?

Whooper
  • 575
  • 4
  • 20
vx2008
  • 95
  • 1
  • 1
  • 10

1 Answers1

3

Stride is the amount you want to skip in a particular direction. Each of your batch is 4 dimensional (batch_size, height, width, channels). But, you know that the computation should not skip any batch and nor should it skip any channel, but what a GPU sees is just a 4D tensor, and hence asks for the stride along each dimension.

tf.nn.conv2d is a low-level implementation in Tensorflow, which exposes the GPU API as it is. There is another high-level implementation as well, tf.layers.Conv2d which only allows you to pass a two element tuple, with height stride and width stride. But, if you want to use the low-level API (maybe due to more control over the parameters), you should always keep batch and column stride to 1.

Lan Vukušič
  • 156
  • 1
  • 10
layog
  • 4,661
  • 1
  • 28
  • 30