Skip to content

Wrap specific padding behavior for convolution layer in tf.keras #2673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

Zhaopudark
Copy link
Contributor

@Zhaopudark Zhaopudark commented Feb 16, 2022

Description

more details in #2674

Extend padding behavior of a keras convolution layer.
For example, a user can get a convolution layer with "same" padding in shape-wise and "reflect" padding in numerical-wise simultaneously. Such as:

x = tf.constant([1.,2.,3.,4.,5.],shape=[1,5,1])
conv1d_ = tf.keras.layers.Conv1D(filters=1, kernel_size=[2,]*1, strides=(1,)*1, padding="same")
conv1d = SpecificConvPad(conv1d_, padding_mode='constant',padding_constant=1)
y = conv1d(x)

Type of change

Checklist:

How Has This Been Tested?

Shape-wise padding behavior has been tested to ensure to be consistent with original padding behavior.

@bhack
Copy link
Contributor

bhack commented Mar 8, 2022

Thanks for the proposal, can you try to open a ticket and propose this in Keras directly:
https://github.com/keras-team/keras

@bhack
Copy link
Contributor

bhack commented May 10, 2022

I think you need to contribute/propose this in Keras or Keras-cv repos

@bhack bhack closed this May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants