1

When I study Deep MNIST for Experts tutorial, I have many difficulties. I'd to know why they used Convolution and Pooling in a Multilayer Convolutional Network.

And I don't understand the following two functions.

def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')

def max_pool_2x2(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],
                    strides=[1, 2, 2, 1], padding='SAME')

I'd to know the meaning of strides=[1,1,1,1] in conv2d function.

Should we always use ksize=[1, 2, 2, 1] and strides=[1, 2, 2, 1] in max_pool_2x2 function.

What is the difference between padding='SAME' and padding='VALID'

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
Necromancer
  • 869
  • 2
  • 9
  • 25
  • 2
    I gave a decent description of most of these in this [answer](http://stackoverflow.com/questions/34619177/what-does-tf-nn-conv2d-do-in-tensorflow/34698115#34698115) – mdaoust Feb 21 '16 at 21:56
  • Possible duplicate of [What is the difference between 'SAME' and 'VALID' padding in tf.nn.max\_pool of tensorflow?](http://stackoverflow.com/questions/37674306/what-is-the-difference-between-same-and-valid-padding-in-tf-nn-max-pool-of-t) – Salvador Dali May 21 '17 at 10:21

1 Answers1

1

I would say check the following answer. It has a wonderful explanation for the whole convolution operation. This should cover your query for conv2d .

for max pooling,

ksize: is basically the kernal size. Its the size of the window for each dimension of the input tensor. you can change it according to your need. Like in the paper AlexNet they have used ksize=[1, 3, 3, 1] and

stride: The filter is applied to image patches of the same size as the filter and strided according to the strides argument. strides = [1, 2, 2, 1] applies the filter to every other image patch in each dimension, etc.

The difference of padding is explained well in this post.

Community
  • 1
  • 1