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

RNN support (part 1) #521

Merged
merged 5 commits into from
Apr 28, 2022
Merged

Conversation

vloncar
Copy link
Contributor

@vloncar vloncar commented Apr 4, 2022

As discussed before, this is the first stage of the RNN support. The PR includes the support for parsing RNN layers into the IR, as well as the Vivado-specific initialization. The same initialization specific to Quartus backend can be part of the second PR. After this is merged, parts 2 and 3 will add HLS implementations for Vivado and Quartus.

@vloncar vloncar mentioned this pull request Apr 15, 2022
3 tasks
@vloncar
Copy link
Contributor Author

vloncar commented Apr 15, 2022

Now also including Embedding layer from #449. @drankincms @jmduarte Can you take a look so we can merge this soon? I'd like to finish the port of Vivado RNN branch (aka part 2).

@drankincms
Copy link
Contributor

So right now this crashes on a GRU I tried with because get_valid_reuse_factors() returns an empty list for the recurrent layers.
In the keras RNN branch I have something like this: https://github.com/drankincms/hls4ml/blob/keras-RNN-staticswitch/hls4ml/templates/vivado_template.py#L478-L501
There might be a better way to pass around recr for this purpose, but I want to make sure @vloncar you see this issue as something that this part 1 PR should solve first before I add a fix.

Copy link
Member

@jmduarte jmduarte left a comment

Choose a reason for hiding this comment

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

@vloncar looks good from my side! I checked and the embedding layer works and synthesizes as expected in my models. We may want to address @drankincms's issue though.

@vloncar
Copy link
Contributor Author

vloncar commented Apr 22, 2022

I added the RF fix from the ongoing port of the RNN branch. There will be more changes in PR2, namely the transposing of weights is moved to the optimizer, in line with the other layers, which in this PR is done in the initializer of Vivado RNN layers.

Copy link
Contributor

@drankincms drankincms left a comment

Choose a reason for hiding this comment

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

All clear for me

@drankincms drankincms merged commit a1a401c into fastmachinelearning:master Apr 28, 2022
@jmduarte jmduarte linked an issue May 4, 2022 that may be closed by this pull request
@vloncar vloncar deleted the rnn_pr1 branch March 5, 2023 17:42
calad0i pushed a commit to calad0i/hls4ml that referenced this pull request Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Embedding layer
3 participants