-
Notifications
You must be signed in to change notification settings - Fork 424
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
Hello, after converting GRU network to IP core using hls4ml, the output of IP core is not always 0. Here is my conversion code. #1111
Comments
Can you please add a few more details? Output from which is not zero: CSim (csim=True in hls4ml.build(...)) or the hls_prediction? Does the line np.testing.assert_allclose fail or something later? |
Thank you very much for your reply. In my project, both hls_prediction and csim can output the result, but when I integrated the IP core derived from hls_model.build(csim=True, export=True) into my FPGA project for simulation, the output of IP core was always 0. Below is my project file、log and generated IP core, I can't find anything wrong? The test_recurrent_pytorch.py file in this project is also our official routine. I use hls4ml to generate the IP core of the fully connected network, and the IP core can be normally output when integrated into the FPGA project.Is there a successful case of hls4ml converting gru network and applying it to FPGA? Can you provide a reference case? |
Unfortunately, we don't provide examples of how to integrate IPs into larger application, as this is application-specific and can be done in many ways:
|
Thank you very much for your reply. I would like to know if your team has any successful cases of converting GRU network into IP core through hls4ml and integrating IP core into FPGA project. If you have a successful case? Then it is very likely that there is a problem in my FPGA project, I will look it up, thank you very much. |
Once you have the IP, it doesn't matter what the underlying architecture is (GRU or CNN or FC etc.). At that point it's a matter of properly connecting all the signals / IP blocks. I personally haven't worked with integrating GRU models (not to say others haven't), but recently I did integrate a FC network in a larger application, and most of my discoveries were explained in those 2 links for number 2) above. |
from pathlib import Path
import numpy as np
import pytest
import torch
import torch.nn as nn
from hls4ml.converters import convert_from_pytorch_model
from hls4ml.utils.config import config_from_pytorch_model
from hls4ml.utils import plot_model
import plotting
import hls4ml
test_root_path = Path(file).parent
import os
os.environ['PATH'] = '/tools/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']
class GRUNet(nn.Module):
def init(self):
super().init()
self.rnn = nn.GRU(4, 2, num_layers=1, batch_first=True, bias=True)
def test_gru(backend, io_type):
model = GRUNet()
model.eval()
if name == 'main':
test_gru('Vivado', 'io_stream')
The text was updated successfully, but these errors were encountered: