Issue
My input size image is :
256 * 256
Conv2d Kernal Size : 4*4
and strides at 2*2
.
The output will be 127*127
.
I want to pass to Max Pool for this i want to apply padding to make it 128*128
so that pooling works well and pooling output will be used in other layers.
How i can apply padding for this conv.
conv1 = tf.layers.conv2d(x, 32, (4,4),strides=(2,2), activation=tf.nn.relu)
Solution
tf.layers.conv2d
has a padding
parameter that you can use to do this. The default is "valid"
which means no padding is done, so each convolution will slightly shrink the input. You can pass padding="same"
instead. This will apply padding such that the output of the convolution is equal in size to the input. This is before strides, so using a stride of 2 will still downsample by a factor 2. In your example, using padding="same"
should result in the convolution output to have size 128x128.
Answered By - xdurch0
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.