in Education by
In tf.nn.max_pool of tensorflow what is the difference between 'SAME' and 'VALID'? I read in here that there's no padding in pool operator means we just have to use 'VALID' of tensorflow. Then what does 'SAME' padding of max pool means in tensorflow? Select the correct answer from above options

1 Answer

0 votes
by
VALID Padding: it means no padding and it assumes that all the dimensions are valid so that the input image gets fully covered by a filter and the stride specified by you. SAME Padding: it applies padding to the input image so that the input image gets fully covered by the filter and specified stride.It is called SAME because, for stride 1 , the output will be the same as the input. Let’s see an example: Here, a is the input image of shape [2, 3], 1 channel validPad refers to max pool having 2x2 kernel, stride=2 and VALID padding. samePad refers to max pool having 2x2 kernel, stride=2 and SAME padding. a = tf.constant([[1., 2., 3.], [4., 5., 6.]]) a = tf.reshape(x, [1, 2, 3, 1]) validPad = tf.nn.max_pool(x, [1, 2, 2, 1], [1, 2, 2, 1], padding='VALID') samePad = tf.nn.max_pool(x, [1, 2, 2, 1], [1, 2, 2, 1], padding='SAME') validPad.get_shape() == [1, 1, 1, 1] samePad.get_shape() == [1, 1, 2, 1] Output shapes are- validPad : output shape is [1,1] samePad: output shape is [1,2]

Related questions

0 votes
    I was looking at the docs of TensorFlow about tf.nn.conv2d here. But I can't understand what it does or ... it raised the question. Select the correct answer from above options...
asked Jan 27, 2022 in Education by JackTerrance
0 votes
    What does the following function do? Should I consider it as a lookup table like in skip-gram model? tf.nn. ... mod', name=None) Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I want to assign a value to a TensorFlow variable in Python and I am using this: import tensorflow as tf import ... do to correct this? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I want different learning layers in different layers just like we do in Caffe. I just want to speed up the training ... can I do this? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I am searching for the better option to save a trained model in PyTorch, these are the options I am using ... the above two functions? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I am having problem in understanding the difference between three optimizers for loss.I went through some documents ... differences? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I read that regularization terms are implemented by manually adding an additional term to loss value in neural network ... it manually? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    What is global_step ? why do we use '0' while setting up global_step? def training(loss,learning_rate): tf. ... global_step becomes 1? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    In the MNIST beginner tutorial, there is the statement accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) tf ... (x,1)? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Suppose I have a Tensorflow tensor. How do I get the dimensions (shape) of the tensor as integer values? I ... 'Dimension' instead. Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I recently started finding out deep learning & machine learning techniques, and I started sorting out frameworks ... machine learning. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    Is tf.contrib.layers.flatten(x) the same as tf.reshape(x, [n, 1])? Can anyone help me with this? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I am trying to understand the role of the Flatten function in Keras. Below is my code, which is a simple two ... flatten it? Thanks! Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I'm wondering how to calculate precision and recall measures for multiclass multilabel classification, i.e. classification ... labels? Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    What is the role of Flatten in Keras. I am executing the code below and it's a two layered network. The ... output is already flat? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
...