I get [-1,256,256,3] as the output shape using the transpose layers shown below. I print the output shape. My question is specifically about the height and width which are both 256. The channels seem to be the number of filters from the last transpose layer in my code.
I assumed rather simplistically that the formula is this. I read other threads.
H = (H1 - 1)*stride + HF - 2*padding
But when I calculate I don't seem to get that output. I think I may be missing the padding calculation
How much padding is added by 'SAME' ?
My code is this.
linear = tf.layers.dense(z, 512 * 8 * 8)
linear = tf.contrib.layers.batch_norm(linear, is_training=is_training,decay=0.88)
conv = tf.reshape(linear, (-1, 128, 128, 1))
out = tf.layers.conv2d_transpose(conv, 64,kernel_size=4,strides=2, padding='SAME')
out = tf.layers.dropout(out, keep_prob)
out = tf.contrib.layers.batch_norm(out, is_training=is_training,decay=0.88)
out = tf.nn.leaky_relu(out)
out = tf.layers.conv2d_transpose(out, 128,kernel_size=4,strides=1, padding='SAME')
out = tf.layers.dropout(out, keep_prob)
out = tf.contrib.layers.batch_norm(out, is_training=is_training,decay=0.88)
out = tf.layers.conv2d_transpose(out, 3,kernel_size=4,strides=1, padding='SAME')
print( out.get_shape())
