Skip to content

Add causal padding #688

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

Merged
merged 6 commits into from
Nov 30, 2022
Merged

Conversation

cgutsche
Copy link
Contributor

This code implements the "causal" padding for Keras Conv1D layers. This padding only adds leading zeros at the left of the input. This means, CNNs only look into the past but can not see into the future for temporal ordered data points.

The implementation is rather easy:
Instead of setting the left and right padding to (kernel size - 1) // 2 just set the left padding to (kernel size - 1) and the right padding to 0. To enable causal padding, also a .py file in backends is changed so that padding is activated if padding is "causal"

Also a simple test file is added.

@vloncar vloncar added the please test Trigger testing by creating local PR branch label Nov 30, 2022
Copy link
Contributor

@vloncar vloncar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Christian!

@vloncar vloncar merged commit 87d360b into fastmachinelearning:main Nov 30, 2022
calad0i pushed a commit to calad0i/hls4ml that referenced this pull request Jul 1, 2023
* add causal padding for Keras Conv1D layers

* rename func

* enable padding for causal in backend

* fix test

* fix test 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please test Trigger testing by creating local PR branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants