Hello everyone,
In the documentation of “tf.keras.layers.Conv1DTranspose”, the type to calculate the output is depicted.
new_timesteps = ((timesteps - 1) * strides + kernel_size -2 * padding + output_padding)
However, tf.keras.layers.Conv1DTranspose does not accept integer type for “padding” argument.
I would like to pass an integer or a List/Tuple containing the paddings for each dimension.
Is this possible?
Thank you!
Hi @kostasnikif, You can only pass valid
and same
values to the padding argument. You cannot pass the integer values. valid
means no padding. same
results in padding with zeros evenly to the left/right or up/down of the input such that output has the same height/width dimension as the input. Thank You.
So why are the provide this formula, while they do not support it?
I mean, it could be sensible to let us choose between “valid”, “same” but at the same time be able to pass an integer as PyTorch does.
Hi @kostasnikif, you can not pass list/tuple to padding argument in the convolution layer. But you can use tf.keras.layers.ZeroPadding2D
where you can pass integers to the padding argument.
For example,
x=tf.keras.layers.ZeroPadding2D(padding=((1, 2), (3, 4)), input_shape=(1,4,4))
x(tensor1)
which will add 1 padding to the top, 2 padding to the bottom, 3 padding to the left, 4 padding to the right. Thank You.