Skip to content
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

fix insertion before a node with multiple inputs + support additional broadcasting #551

Merged

Conversation

jmduarte
Copy link
Member

@jmduarte jmduarte commented May 17, 2022

This PR has a few related fixes

  • fix insertion before a node with multiple inputs
  • correctly insert broadcast stream before a node with multiple inputs (e.g. Add or Concatenate), e.g. see figure below. The current code would behave incorrectly and replace the wrong input (always the first input) for the following layer... this would result in an additional output incorrectly being inferred
  • don't insert broadcast before concatenate (figure below incorrectly does this)

Screen Shot 2022-05-16 at 6 59 26 PM

To do

  • Add a pytest

@nickshey

@jmduarte jmduarte added the bug label May 17, 2022
@jmduarte jmduarte requested a review from thesps May 17, 2022 01:58
@jmduarte jmduarte self-assigned this May 17, 2022
@thesps
Copy link
Contributor

thesps commented May 23, 2022

Pushed to local branch pr/551 to run Gitlab CI, looks like the graph tests still pass. An addition to test_graph.py that touches this new input_idx argument would be good.

@jmduarte
Copy link
Member Author

jmduarte commented May 26, 2022

@thesps I added the test you requested. It was failing though because the only stream broadcasting we supported was of the form: (1, 1, C) -> (H, W, C), and I was testing (H, W, 1) -> (H, W, C).

So I updated our HLS code to support both of these (easy) cases. I also added tests for both cases and added a RuntimeError if a user tries to use a model with broadcasting that is not one of these two cases.

In principle, it should be straightforward(ish) to also support (1, W, C) -> (H, W, C) and (H, 1, C) -> (H, W, C), but this can be a future PR.

@jmduarte jmduarte changed the title fix insertion before a node with multiple inputs fix insertion before a node with multiple inputs + support additional broadcasting May 26, 2022
@jmduarte
Copy link
Member Author

@thesps I think this is ready to be merged unless you have any other comments!

@vloncar vloncar merged commit 27e3014 into fastmachinelearning:master May 31, 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.

3 participants