Skip to content

For encoded convolution, add check for when min_width would have been larger than in_width #610

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 19 commits into from
Feb 17, 2023

Conversation

jmitrevs
Copy link
Contributor

@jmitrevs jmitrevs commented Jul 18, 2022

Description

In the encoded convolution, the case when the in_width is smaller than the nominal min_width needs to be handled as a special case. This attempts to fix this situation. It has been been minimally tested in a conv1d case where in_width = 11 while the kernel width is 9. Additional tests need to be made.

Type of change

For a new feature or function, please create an issue first to discuss it
with us before submitting a pull request.

Note: Please delete options that are not relevant.

  • Bug fix (non-breaking change that fixes an issue)

Tests

test_conv1d_narrow.py fails in main, but passes after this fix. Similarly with test_conv2d_narrow.py.

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.

@jmitrevs jmitrevs changed the title For encoded convolution, add check for when min_width would have been larger than in_width WIP: For encoded convolution, add check for when min_width would have been larger than in_width Jul 18, 2022
@jmitrevs jmitrevs marked this pull request as draft September 15, 2022 22:33
@jmitrevs
Copy link
Contributor Author

This has been tested for 1D, and could be merged in the more restricted sense, but it has not been tested for 2D. I think planning should take into account the future of encoded.

@jmitrevs jmitrevs changed the title WIP: For encoded convolution, add check for when min_width would have been larger than in_width For encoded convolution, add check for when min_width would have been larger than in_width Sep 15, 2022
@jmitrevs
Copy link
Contributor Author

I will restrict this PR to the 1D case because I think that's the only one that would be important. If we fix it for 2D, we can make a different PR.

@jmitrevs jmitrevs added the bug label Oct 13, 2022
@jmitrevs jmitrevs marked this pull request as ready for review October 14, 2022 15:38
@jmitrevs jmitrevs marked this pull request as draft October 28, 2022 22:52
@jmitrevs
Copy link
Contributor Author

There are some issues still, so I am converting to a draft till I get a chance to look.

@jmitrevs jmitrevs marked this pull request as ready for review November 1, 2022 22:09
@jmitrevs jmitrevs added the please test Trigger testing by creating local PR branch label Dec 6, 2022
@jmitrevs jmitrevs requested a review from vloncar December 7, 2022 15:07
@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jan 3, 2023
@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jan 11, 2023
@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jan 11, 2023
@jmitrevs
Copy link
Contributor Author

This should now also fix the same issue with Conv2D.

@jmitrevs
Copy link
Contributor Author

@vloncar, are you happy with the changes here as they are?

@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jan 13, 2023
@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Feb 3, 2023
@jmitrevs
Copy link
Contributor Author

Is there anything left to do here before it's merged?

@jmitrevs jmitrevs added this to the v0.7.0 milestone Feb 16, 2023
@vloncar vloncar merged commit 3ed9193 into fastmachinelearning:main Feb 17, 2023
calad0i pushed a commit to calad0i/hls4ml that referenced this pull request Jul 1, 2023
… larger than in_width (fastmachinelearning#610)

* add special case when W == min_width.

* add test that fails without this fix

* add comments

* Make simple bug fixes before reworking structure

* Try to cleanup how we handle the narrow convolutions

* fix hardcoded returns

* update convolution templates for narrow encoded

* flake8 formatting

* update narrow for conv2d, fix test

* change narrow to unscaled, always do unscaled when in_W == min_W

* pre-commit fixes for nnet_conv1d_stream.h and nnet_conv2d_stream.h

* remove unneeded attributes

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

Successfully merging this pull request may close these issues.

2 participants