Keras Conv2D - padding in X and Y

Hello, everyone!

I am new in this forum but I use actively TensorFlow from few years. I am also willing to contribute.

Here I have this simple question about convolution padding:

I am developing one model using Conv2D layers. Conv2D has padding attribute which controls if a layer output has to keep the same size as the input, docs says that :

padding: one of "valid" or "same" (case-insensitive). "valid" means no padding. "same" results in padding with zeros evenly to the left/right or up/down of the input. When padding="same" and strides=1, the output has the same size as the input.

But I want padding to behave differently in X and Y dimension, so if my input is image with size (W,H) to be able to keep the output size to W but H to be as if the "valid" case, and so to be able to tuples as for stride, dilation and kernel size.

Has been there such feature request in the more recent tensorflows?

Thanks.

@Anton_Milev,

Welcome to the Tensorflow Forum!

No, we would like you to create a feature request in keras Repo.

Thank you!

Hello, @chunduriv.

Thanks. There is already a feature request about this:

In addition I can only justify further this feature with two use cases - 1) when someone needs to use the convolution 2d layer for image scaling and needs resize only in one direction 2) when someone needs padding of Conv2D to resize the output in one direction only

This is not a critical feature but as explained in the original request it should not require big effort because tf.nn.conv2d already offers this feature.

@Anton_Milev,

I mean there is no open feature request. Hence requested you to file a fresh request.

Thank you!